Skip to content

Commit d96fcf6

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

File tree

10 files changed

+31
-31
lines changed

10 files changed

+31
-31
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: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,19 +73,12 @@ const LinkSelected = ({ url, title }: LinkSelectedProps) => {
7373
transition: background-color 0.2s ease-in-out;
7474
`}
7575
>
76-
<Box
77-
$display="inline-block"
78-
$css={css`
79-
margin-right: 0.3rem;
80-
`}
81-
>
8276
{emoji ? (
8377
<Icon iconName={emoji} $size="16px" />
8478
) : (
8579
<SelectedPageIcon width={11.5} />
8680
)}
87-
</Box>
88-
<Text $weight="500" spellCheck="false" $size="16px" $display="inline">
81+
<Text $weight="500" spellCheck="false" $size="16px" $display="inline" $css={css`margin-left: 0.3rem; `}>
8982
{titleWithoutEmoji}
9083
</Text>
9184
</StyledLink>

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

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

18-
import { DocIcon } from '../../doc-management/components/DocIcon';
17+
import { useDocTitleUpdate, DocIcon } from '@/features/docs/doc-management';
18+
import SimpleFileIcon from '@/features/docs/doc-management/assets/simple-document.svg';
1919

2020
interface DocTitleProps {
2121
doc: Doc;
@@ -62,7 +62,7 @@ const DocTitleInput = ({ doc }: DocTitleProps) => {
6262
(inputText: string) => {
6363
const sanitizedTitle = updateDocTitle(
6464
doc,
65-
emoji ? `${emoji} ${inputText.trim()}` : inputText.trim(),
65+
emoji ? `${emoji} ${inputText}` : inputText,
6666
);
6767
const { titleWithoutEmoji: sanitizedTitleWithoutEmoji } =
6868
getEmojiAndTitle(sanitizedTitle);
@@ -87,26 +87,33 @@ const DocTitleInput = ({ doc }: DocTitleProps) => {
8787
<Box
8888
$direction="row"
8989
$align="flex-end"
90-
$gap={spacingsTokens['s']}
90+
$gap={spacingsTokens['xs']}
9191
$minHeight="40px"
9292
>
9393
<Tooltip content={t('Document emoji')} aria-hidden={true} placement="top">
9494
<Box
9595
$css={css`
96-
height: 58px;
96+
height: 36px;
97+
padding: 4px;
98+
padding-top:3px;
9799
cursor: pointer;
100+
&:hover {
101+
background-color: ${colorsTokens['greyscale-100']};
102+
border-radius: 4px;
103+
}
104+
transition: background-color 0.2s ease-in-out;
98105
`}
99106
>
100107
<DocIcon
101-
emojiPicker
108+
withEmojiPicker={doc.abilities.partial_update}
102109
docId={doc.id}
103110
title={doc.title}
104111
emoji={emoji}
105-
$size="50px"
112+
$size="25px"
106113
defaultIcon={
107114
<SimpleFileIcon
108-
width="50px"
109-
height="50px"
115+
width="25px"
116+
height="25px"
110117
aria-hidden="true"
111118
aria-label={t('Simple document icon')}
112119
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)