mirror of
https://github.com/SableClient/Sable.git
synced 2026-11-21 17:41:25 -08:00
cleaned space setting
This commit is contained in:
1 parent
720acdf525
commit
84c49ffc52
4 files changed
+22
-18
No files matched your search
@@ -0,0 +1,5 @@
|
||||
---
|
||||
default: minor
|
||||
---
|
||||
|
||||
Add Space banner support per MSC4221. You can now set it from the space settings.
|
||||
@@ -315,7 +315,7 @@ export type ProfileProps = {
|
||||
function RoomBannerEdit({ bannerURI }: Readonly<ProfileProps>) {
|
||||
const mx = useMatrixClient();
|
||||
const [alertRemove, setAlertRemove] = useState(false);
|
||||
|
||||
|
||||
const space = useRoom();
|
||||
const [stagedUrl, setStagedUrl] = useState<string>();
|
||||
const [isRemoving, setIsRemoving] = useState(false);
|
||||
@@ -353,7 +353,7 @@ function RoomBannerEdit({ bannerURI }: Readonly<ProfileProps>) {
|
||||
const { mxc } = upload;
|
||||
|
||||
if (imageFileURL) setStagedUrl(imageFileURL);
|
||||
mx.sendStateEvent(space.roomId, CustomStateEvent.RoomBanner, {url: mxc}, '');
|
||||
mx.sendStateEvent(space.roomId, CustomStateEvent.RoomBanner, { url: mxc }, '');
|
||||
setImageFile(undefined);
|
||||
},
|
||||
[mx, imageFileURL, space]
|
||||
@@ -364,7 +364,7 @@ function RoomBannerEdit({ bannerURI }: Readonly<ProfileProps>) {
|
||||
setStagedUrl(undefined);
|
||||
setImageFile(undefined);
|
||||
|
||||
mx.sendStateEvent(space.roomId, CustomStateEvent.RoomBanner, {url: ''}, '');
|
||||
mx.sendStateEvent(space.roomId, CustomStateEvent.RoomBanner, { url: '' }, '');
|
||||
|
||||
setAlertRemove(false);
|
||||
};
|
||||
@@ -579,14 +579,16 @@ export function RoomProfile({ permissions }: RoomProfileProps) {
|
||||
</Box>
|
||||
)}
|
||||
</SequenceCard>
|
||||
<SequenceCard
|
||||
className={SequenceCardStyle}
|
||||
variant="SurfaceVariant"
|
||||
direction="Column"
|
||||
gap="400"
|
||||
>
|
||||
<RoomBannerEdit bannerURI={bannerURI ?? undefined}/>
|
||||
</SequenceCard>
|
||||
{room.isSpaceRoom() && (
|
||||
<SequenceCard
|
||||
className={SequenceCardStyle}
|
||||
variant="SurfaceVariant"
|
||||
direction="Column"
|
||||
gap="400"
|
||||
>
|
||||
<RoomBannerEdit bannerURI={bannerURI ?? undefined} />
|
||||
</SequenceCard>
|
||||
)}
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
@@ -237,7 +237,7 @@ function ThemeVisualPreferences() {
|
||||
const [linkPreviewMaxHeightInput, setLinkPreviewMaxHeightInput] = useState(
|
||||
linkPreviewImageMaxHeight.toString()
|
||||
);
|
||||
const [showRoomBanners,setShowRoomBanners] = useSetting(settingsAtom, 'showRoomBanners');
|
||||
const [showRoomBanners, setShowRoomBanners] = useSetting(settingsAtom, 'showRoomBanners');
|
||||
|
||||
const handleIncomingDefaultHeightChange: ChangeEventHandler<HTMLInputElement> = (evt) => {
|
||||
const val = evt.target.value;
|
||||
@@ -627,10 +627,7 @@ function SidebarWidth({ sidebarSelector }: { sidebarSelector: string }) {
|
||||
settingsAtom,
|
||||
'widgetSidebarWidth'
|
||||
);
|
||||
const [roomBannerHeight, setRoomBannerHeight] = useSetting(
|
||||
settingsAtom,
|
||||
'roomBannerHeight'
|
||||
);
|
||||
const [roomBannerHeight, setRoomBannerHeight] = useSetting(settingsAtom, 'roomBannerHeight');
|
||||
|
||||
// Yandere style code but it works and is as straight forward as can be :shrug:
|
||||
const getCurValue = useMemo(() => {
|
||||
@@ -650,7 +647,7 @@ function SidebarWidth({ sidebarSelector }: { sidebarSelector: string }) {
|
||||
threadRootHeight,
|
||||
vcmsgSidebarWidth,
|
||||
widgetSidebarWidth,
|
||||
roomBannerHeight
|
||||
roomBannerHeight,
|
||||
]);
|
||||
const [curValue, setCurValue] = useState(getCurValue);
|
||||
const setValue = (value: number) => {
|
||||
|
||||
@@ -281,7 +281,7 @@ function SpaceHeader({ hideText, mx }: { hideText?: boolean; mx: MatrixClient })
|
||||
const bannerState = useStateEvent(space, CustomStateEvent.RoomBanner);
|
||||
const bannerMXC = bannerState?.getContent<RoomBannerContent>()?.url;
|
||||
const bannerURI = mxcUrlToHttp(mx, bannerMXC ?? '', true);
|
||||
const hasBanner = bannerURI && !hideText && showBanners;
|
||||
const hasBanner = !!(bannerURI && !hideText && showBanners);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
Reference in new issue
Block a user