mirror of
https://github.com/SableClient/Sable.git
synced 2026-11-26 20:06:26 -08:00
basic support for the banner state
This commit is contained in:
1 parent
c2bb68345a
commit
8582765657
4 files changed
+13
No files matched your search
@@ -86,6 +86,8 @@ import { RoomAvatar } from '$components/room-avatar';
|
||||
import { getRoomAvatarUrl } from '$utils/room';
|
||||
import { nameInitials } from '$utils/common';
|
||||
import { useMediaAuthentication } from '$hooks/useMediaAuthentication';
|
||||
import { CustomStateEvent } from '$types/matrix/room';
|
||||
import type { RoomBannerContent } from '$types/matrix-sdk-events';
|
||||
|
||||
const debugLog = createDebugLogger('Space');
|
||||
|
||||
@@ -268,6 +270,8 @@ function SpaceHeader({ hideText, mx }: { hideText?: boolean; mx: MatrixClient })
|
||||
});
|
||||
};
|
||||
|
||||
const bannerState = useStateEvent(space, CustomStateEvent.RoomBanner);
|
||||
const bannerURI = bannerState?.getContent<RoomBannerContent>()?.url;
|
||||
return (
|
||||
<>
|
||||
<PageNavHeader>
|
||||
@@ -303,6 +307,7 @@ function SpaceHeader({ hideText, mx }: { hideText?: boolean; mx: MatrixClient })
|
||||
<Icon src={Icons.VerticalDots} size="200" />
|
||||
</IconButton>
|
||||
</Box>
|
||||
<Text>{bannerURI}</Text>
|
||||
</>
|
||||
)}
|
||||
</Box>
|
||||
|
||||
Vendored
+4
@@ -32,6 +32,9 @@ type RoomCosmeticsPronounsEventContent = {
|
||||
pronouns?: PronounSet[];
|
||||
};
|
||||
|
||||
type RoomBannerContent = {
|
||||
url?: string;
|
||||
};
|
||||
declare module 'matrix-js-sdk/lib/@types/event' {
|
||||
interface StateEvents {
|
||||
[prefix.MATRIX_UNSTABLE_STATE_ROOM_EMOTES_PROPERTY_NAME]: PackContent;
|
||||
@@ -41,6 +44,7 @@ declare module 'matrix-js-sdk/lib/@types/event' {
|
||||
[prefix.MATRIX_SABLE_UNSTABLE_STATE_COSMETICS_MEMBER_FONT_PROPERTY_NAME]: RoomCosmeticsFontEventContent;
|
||||
[prefix.MATRIX_SABLE_UNSTABLE_STATE_COSMETICS_MEMBER_PRONOUNS_PROPERTY_NAME]: RoomCosmeticsPronounsEventContent;
|
||||
[prefix.MATRIX_SABLE_UNSTABLE_STATE_ROOM_ABBREVIATIONS_PROPERTY_NAME]: RoomAbbreviationsContent;
|
||||
[prefix.MATRIX_UNSTABLE_STATE_ROOM_BANNER_PROPERTY_NAME]: RoomBannerContent;
|
||||
}
|
||||
|
||||
interface AccountDataEvents {
|
||||
|
||||
@@ -16,6 +16,7 @@ export const CustomStateEvent = {
|
||||
RoomCosmeticsFont: 'moe.sable.room.cosmetics.font',
|
||||
RoomCosmeticsPronouns: 'moe.sable.room.cosmetics.pronouns',
|
||||
RoomAbbreviations: 'moe.sable.room.abbreviations',
|
||||
RoomBanner: 'page.codeberg.everypizza.room.banner',
|
||||
} as const;
|
||||
export type CustomStateEvent = (typeof CustomStateEvent)[keyof typeof CustomStateEvent];
|
||||
|
||||
|
||||
@@ -15,3 +15,6 @@ export const MATRIX_CINNY_UNSTABLE_STATE_ROOM_POWER_LEVELS_LABEL_PROPERTY_NAME =
|
||||
export const MATRIX_ELEMENT_UNSTABLE_ACCOUNT_RECENT_EMOJIS_PROPERTY_NAME =
|
||||
'io.element.recent_emoji';
|
||||
export const MATRIX_ELEMENT_UNSTABLE_STATE_ROOM_WIDGET_PROPERTY_NAME = 'im.vector.modular.widgets';
|
||||
|
||||
export const MATRIX_UNSTABLE_STATE_ROOM_BANNER_PROPERTY_NAME =
|
||||
'page.codeberg.everypizza.room.banner';
|
||||
Reference in new issue
Block a user