Skip to content

Commit 8957c85

Browse files
committed
fixup! ✨(frontend) add EmojiPicker in DocumentTitle
1 parent 263cd61 commit 8957c85

File tree

10 files changed

+40
-34
lines changed

10 files changed

+40
-34
lines changed

CHANGELOG.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ and this project adheres to
1717
- ♿ add document visible in list and openable via enter key #1365
1818
- ♿ add pdf outline property to enable bookmarks display #1368
1919
- ♿ hide decorative icons from assistive tech with aria-hidden #1404
20+
- ✨(frontend) doc emojis improvements #1381
21+
- add an EmojiPicker in the document tree and document title
22+
- remove emoji buttons in menus
2023

2124
### Fixed
2225

@@ -31,15 +34,11 @@ and this project adheres to
3134
- ♿(frontend) improve accessibility:
3235
- ♿improve NVDA navigation in DocShareModal #1396
3336

34-
3537
## [3.7.0] - 2025-09-12
3638

3739
### Added
3840

3941
- ✨(api) add API route to fetch document content #1206
40-
- ✨(frontend) doc emojis improvements #1381
41-
- add an EmojiPicker in the document tree and document title
42-
- remove emoji buttons in menus
4342

4443
### Changed
4544

src/frontend/apps/impress/src/features/docs/doc-editor/components/custom-inline-content/Interlinking/InterlinkingLinkInlineContent.tsx

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { createReactInlineContentSpec } from '@blocknote/react';
33
import { useEffect } from 'react';
44
import { css } from 'styled-components';
55

6-
import { Box, Icon, StyledLink, Text } from '@/components';
6+
import { Icon, StyledLink, Text } from '@/components';
77
import { useCunninghamTheme } from '@/cunningham';
88
import SelectedPageIcon from '@/docs/doc-editor/assets/doc-selected.svg';
99
import { getEmojiAndTitle, useDoc } from '@/docs/doc-management';
@@ -73,19 +73,20 @@ const LinkSelected = ({ url, title }: LinkSelectedProps) => {
7373
transition: background-color 0.2s ease-in-out;
7474
`}
7575
>
76-
<Box
77-
$display="inline-block"
76+
{emoji ? (
77+
<Icon iconName={emoji} $size="16px" />
78+
) : (
79+
<SelectedPageIcon width={11.5} />
80+
)}
81+
<Text
82+
$weight="500"
83+
spellCheck="false"
84+
$size="16px"
85+
$display="inline"
7886
$css={css`
79-
margin-right: 0.3rem;
87+
margin-left: 0.3rem;
8088
`}
8189
>
82-
{emoji ? (
83-
<Icon iconName={emoji} $size="16px" />
84-
) : (
85-
<SelectedPageIcon width={11.5} />
86-
)}
87-
</Box>
88-
<Text $weight="500" spellCheck="false" $size="16px" $display="inline">
8990
{titleWithoutEmoji}
9091
</Text>
9192
</StyledLink>

src/frontend/apps/impress/src/features/docs/doc-header/components/DocTitle.tsx

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,10 @@ import {
1111
useDocStore,
1212
useTrans,
1313
} from '@/docs/doc-management';
14+
import { DocIcon, useDocTitleUpdate } from '@/features/docs/doc-management';
1415
import SimpleFileIcon from '@/features/docs/doc-management/assets/simple-document.svg';
15-
import { useDocTitleUpdate } from '@/features/docs/doc-management/hooks/useDocTitleUpdate';
1616
import { useResponsiveStore } from '@/stores';
1717

18-
import { DocIcon } from '../../doc-management/components/DocIcon';
19-
2018
interface DocTitleProps {
2119
doc: Doc;
2220
}
@@ -62,7 +60,7 @@ const DocTitleInput = ({ doc }: DocTitleProps) => {
6260
(inputText: string) => {
6361
const sanitizedTitle = updateDocTitle(
6462
doc,
65-
emoji ? `${emoji} ${inputText.trim()}` : inputText.trim(),
63+
emoji ? `${emoji} ${inputText}` : inputText,
6664
);
6765
const { titleWithoutEmoji: sanitizedTitleWithoutEmoji } =
6866
getEmojiAndTitle(sanitizedTitle);
@@ -87,26 +85,33 @@ const DocTitleInput = ({ doc }: DocTitleProps) => {
8785
<Box
8886
$direction="row"
8987
$align="flex-end"
90-
$gap={spacingsTokens['s']}
88+
$gap={spacingsTokens['xs']}
9189
$minHeight="40px"
9290
>
9391
<Tooltip content={t('Document emoji')} aria-hidden={true} placement="top">
9492
<Box
9593
$css={css`
96-
height: 58px;
94+
height: 36px;
95+
padding: 4px;
96+
padding-top: 3px;
9797
cursor: pointer;
98+
&:hover {
99+
background-color: ${colorsTokens['greyscale-100']};
100+
border-radius: 4px;
101+
}
102+
transition: background-color 0.2s ease-in-out;
98103
`}
99104
>
100105
<DocIcon
101-
emojiPicker
106+
withEmojiPicker={doc.abilities.partial_update}
102107
docId={doc.id}
103108
title={doc.title}
104109
emoji={emoji}
105-
$size="50px"
110+
$size="25px"
106111
defaultIcon={
107112
<SimpleFileIcon
108-
width="50px"
109-
height="50px"
113+
width="25px"
114+
height="25px"
110115
aria-hidden="true"
111116
aria-label={t('Simple document icon')}
112117
color={colorsTokens['primary-500']}

src/frontend/apps/impress/src/features/docs/doc-header/components/DocToolBox.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ export const DocToolBox = ({ doc }: DocToolBoxProps) => {
136136
},
137137
testId: `docs-actions-${doc.is_favorite ? 'unpin' : 'pin'}-${doc.id}`,
138138
},
139-
...(emoji
139+
...(emoji && doc.abilities.partial_update
140140
? [
141141
{
142142
label: t('Remove emoji'),

src/frontend/apps/impress/src/features/docs/doc-management/components/DocIcon.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { useDocTitleUpdate } from '../hooks/useDocTitleUpdate';
1010

1111
type DocIconProps = TextType & {
1212
emoji?: string | null;
13-
emojiPicker?: boolean;
13+
withEmojiPicker?: boolean;
1414
defaultIcon: React.ReactNode;
1515
docId?: string;
1616
title?: string;
@@ -19,11 +19,11 @@ type DocIconProps = TextType & {
1919

2020
export const DocIcon = ({
2121
emoji,
22+
withEmojiPicker = false,
2223
defaultIcon,
2324
$size = 'sm',
2425
$variation = '1000',
2526
$weight = '400',
26-
emojiPicker = false,
2727
docId,
2828
title,
2929
onEmojiUpdate,
@@ -40,12 +40,12 @@ export const DocIcon = ({
4040
left: number;
4141
}>({ top: 0, left: 0 });
4242

43-
if (!emojiPicker && !emoji) {
43+
if (!withEmojiPicker && !emoji) {
4444
return defaultIcon;
4545
}
4646

4747
const toggleEmojiPicker = (e: React.MouseEvent) => {
48-
if (emojiPicker) {
48+
if (withEmojiPicker) {
4949
e.stopPropagation();
5050
e.preventDefault();
5151

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
export * from './DocPage403';
22
export * from './ModalRemoveDoc';
33
export * from './SimpleDocItem';
4+
export * from './DocIcon';

src/frontend/apps/impress/src/features/docs/doc-management/hooks/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ export * from './useCreateChildDocTree';
44
export * from './useDocUtils';
55
export * from './useIsCollaborativeEditable';
66
export * from './useTrans';
7+
export * from './useDocTitleUpdate';

src/frontend/apps/impress/src/features/docs/doc-management/hooks/useDocTitleUpdate.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export const useDocTitleUpdate = (options?: UseDocUpdateOptions) => {
4747

4848
// When blank we set to untitled
4949
if (!sanitizedTitle) {
50+
updateDoc({ id: doc.id, title: '' });
5051
return '';
5152
}
5253

@@ -63,9 +64,7 @@ export const useDocTitleUpdate = (options?: UseDocUpdateOptions) => {
6364
const updateDocEmoji = useCallback(
6465
(docId: string, title: string, emoji: string) => {
6566
const { titleWithoutEmoji } = getEmojiAndTitle(title);
66-
console.log('updateDocEmoji', `${emoji} ${titleWithoutEmoji}`);
6767
updateDoc({ id: docId, title: `${emoji} ${titleWithoutEmoji}` });
68-
console.log('updateDocEmoji done');
6968
},
7069
[updateDoc],
7170
);

src/frontend/apps/impress/src/features/docs/doc-tree/components/DocSubPageItem.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,9 @@ export const DocSubPageItem = (props: TreeViewNodeProps<Doc>) => {
166166
<Box $width="16px" $height="16px">
167167
<DocIcon
168168
emoji={emoji}
169+
withEmojiPicker={doc.abilities.partial_update}
169170
defaultIcon={<SubPageIcon />}
170171
$size="sm"
171-
emojiPicker
172172
docId={doc.id}
173173
title={doc.title}
174174
/>

src/frontend/apps/impress/src/features/docs/doc-tree/components/DocTreeItemActions.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export const DocTreeItemActions = ({
9292
},
9393
...(!isRoot
9494
? [
95-
...(emoji
95+
...(emoji && doc.abilities.partial_update
9696
? [
9797
{
9898
label: t('Remove emoji'),

0 commit comments

Comments
 (0)