Skip to content

Commit c4f7f6c

Browse files
committed
Add happy coding message to footer when home is active
- when in Home, show text 'Happy coding!' instead of [History] [Undo] etc buttons. Do this by still rendering them but with visibility none. - translate 'happy coding' to 'miłego kodowania' etc. └── apps └── editor └── src └── views ├── prompt │ └── frontend │ ├── Home │ │ ├── Home.module.scss │ │ ├── Home.tsx │ │ ├── hooks │ │ │ ├── use-has-scrolled-past-mode-button.ts │ │ │ ├── use-keyboard-shortcuts.ts │ │ │ └── use-tasks.ts │ │ └── index.ts │ ├── Prompt.module.scss │ ├── Prompt.tsx │ ├── components │ │ ├── Layout │ │ │ ├── Footer │ │ │ │ ├── Footer.module.scss │ │ │ │ ├── Footer.tsx │ │ │ │ ├── hooks │ │ │ │ │ └── use-dimmed-icons.ts │ │ │ │ └── index.ts │ │ │ ├── Layout.module.scss │ │ │ └── Layout.tsx │ │ └── recent-donations │ │ └── RecentDonationsFooter │ │ ├── RecentDonationsFooter.module.scss │ │ ├── RecentDonationsFooter.tsx │ │ └── index.ts │ └── i18n │ ├── translations │ │ ├── footer.ts │ │ └── index.ts │ └── use-translation.tsx └── shared └── hooks └── use-translation.tsx
1 parent 46cf8c5 commit c4f7f6c

3 files changed

Lines changed: 79 additions & 27 deletions

File tree

‎apps/editor/src/views/prompt/frontend/components/Layout/Footer/Footer.module.scss‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,29 @@
1616
gap: 4px;
1717
}
1818

19+
&__actions {
20+
position: relative;
21+
align-items: center;
22+
}
23+
24+
&__actions-buttons {
25+
display: flex;
26+
gap: 4px;
27+
28+
&--hidden {
29+
visibility: hidden;
30+
pointer-events: none;
31+
}
32+
}
33+
34+
&__happy-coding {
35+
position: absolute;
36+
right: 0;
37+
white-space: nowrap;
38+
font-size: 12px;
39+
color: var(--cwc-text-color-dimmed);
40+
}
41+
1942
&__icon-button {
2043
--size: 24px;
2144
box-sizing: border-box;

‎apps/editor/src/views/prompt/frontend/components/Layout/Footer/Footer.tsx‎

Lines changed: 38 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -69,33 +69,44 @@ export const Footer: React.FC<Props> = (props) => {
6969
</button>
7070
</div>
7171

72-
<div>
73-
<CompactableActionButton
74-
is_compact={compact_step >= 2}
75-
on_click={props.on_history_click}
76-
codicon="history"
77-
label={t('footer.action.history')}
78-
/>
79-
<CompactableActionButton
80-
is_compact={compact_step >= 1}
81-
on_click={on_undo_click}
82-
disabled={!can_undo}
83-
codicon="discard"
84-
label={t('footer.action.undo')}
85-
/>
86-
<CompactableActionButton
87-
is_compact={compact_step >= 3}
88-
on_click={on_commit_click}
89-
disabled={!has_changes_to_commit}
90-
codicon="git-pull-request-comment"
91-
label={t('footer.action.commit')}
92-
/>
93-
<CompactableActionButton
94-
is_compact={compact_step >= 4}
95-
on_click={on_apply_click}
96-
codicon="sparkle"
97-
label={t('footer.action.apply')}
98-
/>
72+
<div className={styles.footer__actions}>
73+
<div
74+
className={cn(styles['footer__actions-buttons'], {
75+
[styles['footer__actions-buttons--hidden']]: props.is_home_active
76+
})}
77+
>
78+
<CompactableActionButton
79+
is_compact={compact_step >= 2}
80+
on_click={props.on_history_click}
81+
codicon="history"
82+
label={t('footer.action.history')}
83+
/>
84+
<CompactableActionButton
85+
is_compact={compact_step >= 1}
86+
on_click={on_undo_click}
87+
disabled={!can_undo}
88+
codicon="discard"
89+
label={t('footer.action.undo')}
90+
/>
91+
<CompactableActionButton
92+
is_compact={compact_step >= 3}
93+
on_click={on_commit_click}
94+
disabled={!has_changes_to_commit}
95+
codicon="git-pull-request-comment"
96+
label={t('footer.action.commit')}
97+
/>
98+
<CompactableActionButton
99+
is_compact={compact_step >= 4}
100+
on_click={on_apply_click}
101+
codicon="sparkle"
102+
label={t('footer.action.apply')}
103+
/>
104+
</div>
105+
{props.is_home_active && (
106+
<span className={styles['footer__happy-coding']}>
107+
{t('footer.happy-coding')}
108+
</span>
109+
)}
99110
</div>
100111
</div>
101112
)

‎apps/editor/src/views/prompt/frontend/i18n/translations/footer.ts‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,5 +88,23 @@ export const footer = {
8888
cs: 'Historie',
8989
hu: 'Előzmények',
9090
bg: 'История'
91+
},
92+
'footer.happy-coding': {
93+
en: 'Happy coding!',
94+
pl: 'Miłego kodowania!',
95+
'zh-cn': '编程愉快!',
96+
ja: '楽しいコーディングを!',
97+
'zh-tw': '編程愉快!',
98+
de: 'Frohes Programmieren!',
99+
es: '¡Feliz programación!',
100+
fr: 'Bon codage !',
101+
'pt-br': 'Boa programação!',
102+
ru: 'Приятного кодинга!',
103+
ko: '즐거운 코딩 되세요!',
104+
it: 'Buona programmazione!',
105+
tr: 'İyi kodlamalar!',
106+
cs: 'Příjemné kódování!',
107+
hu: 'Jó kódolást!',
108+
bg: 'Приятно кодиране!'
91109
}
92110
} as const

0 commit comments

Comments
 (0)