Skip to content

Commit f40d864

Browse files
committed
fixup! ✨(frontend) add EmojiPicker in DocumentTitle
1 parent 4f35526 commit f40d864

File tree

12 files changed

+47
-48
lines changed

12 files changed

+47
-48
lines changed

CHANGELOG.md

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ and this project adheres to
2121
- ♿ remove redundant aria-label on hidden icons and update tests #1432
2222
- ♿ improve semantic structure and aria roles of leftpanel #1431
2323
- ♿ add default background to left panel for better accessibility #1423
24+
- ♿ improve NVDA navigation in DocShareModal #1396
25+
- ✨(frontend) doc emojis improvements #1381
26+
- add an EmojiPicker in the document tree and document title
27+
- remove emoji buttons in menus
28+
- 🩹(frontend) on main pages do not display leading emoji as page icon #1381
29+
- 🩹(frontend) handle properly emojis in interlinking #1381
2430

2531
### Fixed
2632

@@ -30,20 +36,11 @@ and this project adheres to
3036
- 🐛(frontend) fix legacy role computation #1376
3137
- 🐛(frontend) scroll back to top when navigate to a document #1406
3238

33-
### Changed
34-
35-
- ♿(frontend) improve accessibility:
36-
- ♿improve NVDA navigation in DocShareModal #1396
37-
38-
3939
## [3.7.0] - 2025-09-12
4040

4141
### Added
4242

4343
- ✨(api) add API route to fetch document content #1206
44-
- ✨(frontend) doc emojis improvements #1381
45-
- add an EmojiPicker in the document tree and document title
46-
- remove emoji buttons in menus
4744

4845
### Changed
4946

@@ -57,8 +54,6 @@ and this project adheres to
5754
- ✨unify tab focus style for better visual consistency #1341
5855
- ♿hide decorative icons, label menus, avoid accessible name… #1362
5956
- ♻️(tilt) use helm dev-backend chart
60-
- 🩹(frontend) on main pages do not display leading emoji as page icon #1381
61-
- 🩹(frontend) handle properly emojis in interlinking #1381
6257

6358
### Removed
6459

src/frontend/apps/impress/src/features/docs/doc-editor/components/EmojiPicker.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export const EmojiPicker = ({
3636
if (withOverlay) {
3737
return (
3838
<>
39-
{/* Overlay transparent pour fermer en cliquant à l'extérieur */}
39+
{/* Transparent overlay to close by clicking outside */}
4040
<div
4141
style={{
4242
position: 'fixed',

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: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ import React from 'react';
22
import { createPortal } from 'react-dom';
33
import { useTranslation } from 'react-i18next';
44

5-
import { Box, Icon, TextType } from '@/components';
5+
import { Box, Text, TextType } from '@/components';
66

77
import { EmojiPicker } from '../../doc-editor/components/EmojiPicker';
88
import emojidata from '../../doc-editor/components/custom-blocks/initEmojiCallout';
99
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,17 +19,16 @@ 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,
3030
...textProps
3131
}: DocIconProps) => {
32-
3332
const { t } = useTranslation();
3433
const { updateDocEmoji } = useDocTitleUpdate();
3534

@@ -41,12 +40,12 @@ export const DocIcon = ({
4140
left: number;
4241
}>({ top: 0, left: 0 });
4342

44-
if (!emojiPicker && !emoji) {
43+
if (!withEmojiPicker && !emoji) {
4544
return defaultIcon;
4645
}
4746

4847
const toggleEmojiPicker = (e: React.MouseEvent) => {
49-
if (emojiPicker) {
48+
if (withEmojiPicker) {
5049
e.stopPropagation();
5150
e.preventDefault();
5251

@@ -84,9 +83,8 @@ export const DocIcon = ({
8483
{!emoji ? (
8584
defaultIcon
8685
) : (
87-
<Icon
86+
<Text
8887
{...textProps}
89-
iconName={emoji}
9088
$size={$size}
9189
$variation={$variation}
9290
$weight={$weight}
@@ -95,7 +93,7 @@ export const DocIcon = ({
9593
data-testid="doc-emoji-icon"
9694
>
9795
{emoji}
98-
</Icon>
96+
</Text>
9997
)}
10098
</Box>
10199
{openEmojiPicker &&

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ export const SimpleDocItem = ({
6464
color={colorsTokens['primary-500']}
6565
/>
6666
) : (
67-
6867
<SimpleFileIcon
6968
width="32px"
7069
height="32px"
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
);

0 commit comments

Comments
 (0)