Skip to content

Commit 96226ff

Browse files
authored
feat(sticker): add a direct link to room/space settings when sticker list is empty (#1016)
<!-- Please read https://github.com/SableClient/Sable/blob/dev/CONTRIBUTING.md before submitting your pull request --> ### Description hey! i was helping onboard some friends and sable is really cool. i wanted to add a bit of an easier way to get into the sticker page, so i added quick links to them in the room & space bits of text: <img width="428" height="525" alt="Screenshot_2026-06-30_18-41-32" src="https://github.com/user-attachments/assets/57bb6273-9681-4d0c-960a-1beb07e62e6d" /> there doesn't seem to be an existing style to piggy-back off for the links, so i put something quick together. happy to change to whatever works best, the contrast is probably a bit low in the default dark theme? #### Type of change - [ ] Bug fix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update ### Checklist: - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have made corresponding changes to the documentation - [x] My changes generate no new warnings ### AI disclosure: - [ ] Partially AI assisted (clarify which code was AI assisted and briefly explain what it does). - [ ] Fully AI generated (explain what all the generated code does in moderate detail). <!-- Write any explanation required here, but do not generate the explanation using AI!! You must prove you understand what the code in this PR does. -->
2 parents 72509ce + 056dbed commit 96226ff

4 files changed

Lines changed: 66 additions & 2 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
default: patch
3+
---
4+
5+
Add a direct link to room/space settings when the current sticker list is empty

src/app/components/emoji-board/components/NoStickerPacks.tsx

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,30 @@
1-
import { Box, toRem, config, Text } from 'folds';
1+
import { Box, config, Text, toRem } from 'folds';
22
import { dropzoneIcon, Sticker } from '$components/icons/phosphor';
3+
import { useOpenRoomSettings } from '$state/hooks/roomSettings.ts';
4+
import { useOpenSpaceSettings } from '$state/hooks/spaceSettings.ts';
5+
import { useRoomOptionally } from '$hooks/useRoom.ts';
6+
import { useSpaceOptionally } from '$hooks/useSpace.ts';
7+
import * as css from './styles.css';
8+
import { RoomSettingsPage } from '$state/roomSettings.ts';
9+
import { SpaceSettingsPage } from '$state/spaceSettings.ts';
10+
11+
function OptionallyLinkedText(props: { text: string; isLink: boolean; onClick: () => void }) {
12+
return props.isLink ? (
13+
<Text as="span" className={css.TextLink} onClick={props.onClick} size="Inherit">
14+
{props.text}
15+
</Text>
16+
) : (
17+
<>{props.text}</>
18+
);
19+
}
320

421
export function NoStickerPacks() {
22+
const openRoomSettings = useOpenRoomSettings();
23+
const openSpaceSettings = useOpenSpaceSettings();
24+
25+
const room = useRoomOptionally();
26+
const space = useSpaceOptionally();
27+
528
return (
629
<Box
730
style={{ padding: `${toRem(60)} ${config.space.S500}` }}
@@ -14,7 +37,31 @@ export function NoStickerPacks() {
1437
<Box direction="Inherit">
1538
<Text align="Center">No Sticker Packs!</Text>
1639
<Text priority="300" align="Center" size="T200">
17-
Add stickers from user, room or space settings.
40+
Add stickers from user,{' '}
41+
<OptionallyLinkedText
42+
text="room"
43+
isLink={room !== null}
44+
onClick={() =>
45+
openRoomSettings(
46+
room?.roomId as string,
47+
space?.roomId,
48+
RoomSettingsPage.EmojisStickersPage
49+
)
50+
}
51+
/>
52+
{', '}or{' '}
53+
<OptionallyLinkedText
54+
text="space"
55+
isLink={room !== null && space !== null}
56+
onClick={() =>
57+
openSpaceSettings(
58+
room?.roomId as string,
59+
space?.roomId,
60+
SpaceSettingsPage.EmojisStickersPage
61+
)
62+
}
63+
/>{' '}
64+
settings.
1865
</Text>
1966
</Box>
2067
</Box>

src/app/components/emoji-board/components/styles.css.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,3 +228,11 @@ export const GifImg = style({
228228
objectFit: 'cover',
229229
borderRadius: config.radii.R400,
230230
});
231+
232+
export const TextLink = style({
233+
color: 'var(--tc-link)',
234+
cursor: 'pointer',
235+
':hover': {
236+
textDecoration: 'underline',
237+
},
238+
});

src/app/hooks/useRoom.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ export function useRoom(): Room {
1111
return room;
1212
}
1313

14+
export function useRoomOptionally(): Room | null {
15+
return useContext(RoomContext);
16+
}
17+
1418
const IsDirectRoomContext = createContext(false);
1519

1620
export const IsDirectRoomProvider = IsDirectRoomContext.Provider;

0 commit comments

Comments
 (0)