mirror of
https://github.com/tulir/gomuks.git
synced 2025-04-20 18:43:41 -05:00
web/settings: render room details in settings
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
This commit is contained in:
parent
455c82a2c4
commit
c6163806bd
3 changed files with 39 additions and 1 deletions
|
@ -151,4 +151,9 @@ img.avatar {
|
||||||
width: 1rem;
|
width: 1rem;
|
||||||
height: 1rem;
|
height: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.large {
|
||||||
|
width: 5rem;
|
||||||
|
height: 5rem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,20 @@
|
||||||
div.settings-view {
|
div.settings-view {
|
||||||
|
div.room-details {
|
||||||
|
display: flex;
|
||||||
|
gap: .5rem;
|
||||||
|
|
||||||
|
img.avatar {
|
||||||
|
margin-top: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.room-name {
|
||||||
|
font-size: 1.2rem;
|
||||||
|
font-weight: bold;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
text-wrap: nowrap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
width: min(60rem, 80vw);
|
width: min(60rem, 80vw);
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
import { Suspense, lazy, use, useCallback, useRef, useState } from "react"
|
import { Suspense, lazy, use, useCallback, useRef, useState } from "react"
|
||||||
import { ScaleLoader } from "react-spinners"
|
import { ScaleLoader } from "react-spinners"
|
||||||
import Client from "@/api/client.ts"
|
import Client from "@/api/client.ts"
|
||||||
|
import { getRoomAvatarURL } from "@/api/media.ts"
|
||||||
import { RoomStateStore, usePreferences } from "@/api/statestore"
|
import { RoomStateStore, usePreferences } from "@/api/statestore"
|
||||||
import {
|
import {
|
||||||
Preference,
|
Preference,
|
||||||
|
@ -25,8 +26,10 @@ import {
|
||||||
preferenceContextToInt,
|
preferenceContextToInt,
|
||||||
preferences,
|
preferences,
|
||||||
} from "@/api/types/preferences"
|
} from "@/api/types/preferences"
|
||||||
|
import { useEventAsState } from "@/util/eventdispatcher.ts"
|
||||||
import useEvent from "@/util/useEvent.ts"
|
import useEvent from "@/util/useEvent.ts"
|
||||||
import ClientContext from "../ClientContext.ts"
|
import ClientContext from "../ClientContext.ts"
|
||||||
|
import { LightboxContext } from "../modal/Lightbox.tsx"
|
||||||
import JSONView from "../util/JSONView.tsx"
|
import JSONView from "../util/JSONView.tsx"
|
||||||
import Toggle from "../util/Toggle.tsx"
|
import Toggle from "../util/Toggle.tsx"
|
||||||
import CloseIcon from "@/icons/close.svg?react"
|
import CloseIcon from "@/icons/close.svg?react"
|
||||||
|
@ -289,6 +292,7 @@ const AppliedSettingsView = ({ room }: SettingsViewProps) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const SettingsView = ({ room }: SettingsViewProps) => {
|
const SettingsView = ({ room }: SettingsViewProps) => {
|
||||||
|
const roomMeta = useEventAsState(room.meta)
|
||||||
const client = use(ClientContext)!
|
const client = use(ClientContext)!
|
||||||
const setPref = useCallback((context: PreferenceContext, key: keyof Preferences, value: PreferenceValueType | undefined) => {
|
const setPref = useCallback((context: PreferenceContext, key: keyof Preferences, value: PreferenceValueType | undefined) => {
|
||||||
if (context === PreferenceContext.Account) {
|
if (context === PreferenceContext.Account) {
|
||||||
|
@ -330,7 +334,20 @@ const SettingsView = ({ room }: SettingsViewProps) => {
|
||||||
const roomLocal = room.localPreferenceCache
|
const roomLocal = room.localPreferenceCache
|
||||||
return <>
|
return <>
|
||||||
<h2>Settings</h2>
|
<h2>Settings</h2>
|
||||||
<code>{room.roomID}</code>
|
<div className="room-details">
|
||||||
|
<img
|
||||||
|
className="avatar large"
|
||||||
|
loading="lazy"
|
||||||
|
src={getRoomAvatarURL(roomMeta)}
|
||||||
|
onClick={use(LightboxContext)}
|
||||||
|
alt=""
|
||||||
|
/>
|
||||||
|
<div>
|
||||||
|
{roomMeta.name && <div className="room-name">{roomMeta.name}</div>}
|
||||||
|
<code>{room.roomID}</code>
|
||||||
|
<div>{roomMeta.topic}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
Loading…
Add table
Reference in a new issue