Skip to content

Commit 66dbf8c

Browse files
olaurendeauAntoLC
authored andcommitted
fixup! ✨(frontend) add EmojiPicker in DocumentTitle
1 parent aba36c6 commit 66dbf8c

File tree

10 files changed

+42
-30
lines changed

10 files changed

+42
-30
lines changed

CHANGELOG.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to
99
### Added
1010

1111
- ✨(frontend) add pdf block to the editor #1293
12+
- ✨(frontend) add an EmojiPicker in the document tree and title #1381
1213

1314
### Changed
1415

@@ -44,14 +45,15 @@ and this project adheres to
4445
- 🐛(frontend) exclude h4-h6 headings from table of contents #1441
4546
- 🔒(frontend) prevent readers from changing callout emoji #1449
4647

48+
## Removed
49+
50+
- 🔥(frontend) remove emoji buttons in doc grid #1419
51+
4752
## [3.7.0] - 2025-09-12
4853

4954
### Added
5055

5156
- ✨(api) add API route to fetch document content #1206
52-
- ✨(frontend) doc emojis improvements #1381
53-
- add an EmojiPicker in the document tree and document title
54-
- remove emoji buttons in menus
5557

5658
### Changed
5759

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 & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
useIsCollaborativeEditable,
1515
useTrans,
1616
} from '@/docs/doc-management';
17+
import { DocIcon, useDocTitleUpdate } from '@/features/docs/doc-management';
1718
import SimpleFileIcon from '@/features/docs/doc-management/assets/simple-document.svg';
1819
import { useResponsiveStore } from '@/stores';
1920

@@ -65,7 +66,7 @@ const DocTitleInput = ({ doc }: DocTitleProps) => {
6566
(inputText: string) => {
6667
const sanitizedTitle = updateDocTitle(
6768
doc,
68-
emoji ? `${emoji} ${inputText.trim()}` : inputText.trim(),
69+
emoji ? `${emoji} ${inputText}` : inputText,
6970
);
7071
const { titleWithoutEmoji: sanitizedTitleWithoutEmoji } =
7172
getEmojiAndTitle(sanitizedTitle);
@@ -90,26 +91,33 @@ const DocTitleInput = ({ doc }: DocTitleProps) => {
9091
<Box
9192
$direction="row"
9293
$align="flex-end"
93-
$gap={spacingsTokens['s']}
94+
$gap={spacingsTokens['xs']}
9495
$minHeight="40px"
9596
>
9697
<Tooltip content={t('Document emoji')} aria-hidden={true} placement="top">
9798
<Box
9899
$css={css`
99-
height: 58px;
100+
height: 36px;
101+
padding: 4px;
102+
padding-top: 3px;
100103
cursor: pointer;
104+
&:hover {
105+
background-color: ${colorsTokens['greyscale-100']};
106+
border-radius: 4px;
107+
}
108+
transition: background-color 0.2s ease-in-out;
101109
`}
102110
>
103111
<DocIcon
104-
emojiPicker
112+
withEmojiPicker={doc.abilities.partial_update}
105113
docId={doc.id}
106114
title={doc.title}
107115
emoji={emoji}
108-
$size="50px"
116+
$size="25px"
109117
defaultIcon={
110118
<SimpleFileIcon
111-
width="50px"
112-
height="50px"
119+
width="25px"
120+
height="25px"
113121
aria-hidden="true"
114122
aria-label={t('Simple document icon')}
115123
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
@@ -8,7 +8,7 @@ import { useDocTitleUpdate } from '../hooks/useDocTitleUpdate';
88

99
type DocIconProps = TextType & {
1010
emoji?: string | null;
11-
emojiPicker?: boolean;
11+
withEmojiPicker?: boolean;
1212
defaultIcon: React.ReactNode;
1313
docId?: string;
1414
title?: string;
@@ -17,11 +17,11 @@ type DocIconProps = TextType & {
1717

1818
export const DocIcon = ({
1919
emoji,
20+
withEmojiPicker = false,
2021
defaultIcon,
2122
$size = 'sm',
2223
$variation = '1000',
2324
$weight = '400',
24-
emojiPicker = false,
2525
docId,
2626
title,
2727
onEmojiUpdate,
@@ -37,12 +37,12 @@ export const DocIcon = ({
3737
left: number;
3838
}>({ top: 0, left: 0 });
3939

40-
if (!emojiPicker && !emoji) {
40+
if (!withEmojiPicker && !emoji) {
4141
return defaultIcon;
4242
}
4343

4444
const toggleEmojiPicker = (e: React.MouseEvent) => {
45-
if (emojiPicker) {
45+
if (withEmojiPicker) {
4646
e.stopPropagation();
4747
e.preventDefault();
4848

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ export * from './DocIcon';
22
export * from './DocPage403';
33
export * from './ModalRemoveDoc';
44
export * from './SimpleDocItem';
5+
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
@@ -5,3 +5,4 @@ export * from './useDocTitleUpdate';
55
export * from './useDocUtils';
66
export * from './useIsCollaborativeEditable';
77
export * from './useTrans';
8+
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)