Skip to content

Commit 00e34df

Browse files
authored
Merge 472f527 into 01b2606
2 parents 01b2606 + 472f527 commit 00e34df

File tree

13 files changed

+183
-59
lines changed

13 files changed

+183
-59
lines changed

public/app.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/Controls.tsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -241,13 +241,18 @@ export default function Controls({
241241
}}
242242
>
243243
{modes.map(mode => (
244-
<button
244+
<div
245+
className="tsml-dropdown__item"
245246
data-active={state.input.mode === mode}
246247
key={mode}
247-
onClick={e => setMode(e, mode)}
248-
>
249-
{strings.modes[mode]}
250-
</button>
248+
>
249+
<button
250+
className="tsml-dropdown__button"
251+
onClick={e => setMode(e, mode)}
252+
>
253+
{strings.modes[mode]}
254+
</button>
255+
</div>
251256
))}
252257
</div>
253258
)}

src/components/Dropdown.tsx

Lines changed: 63 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Dispatch, Fragment, MouseEvent, SetStateAction } from 'react';
1+
import { Dispatch, Fragment, MouseEvent, SetStateAction, useState } from 'react';
22

33
import { useSearchParams } from 'react-router-dom';
44

@@ -24,6 +24,21 @@ export default function Dropdown({
2424
const { strings } = useSettings();
2525
const options = state.indexes[filter];
2626
const values = state.input[filter];
27+
const [expanded, setExpanded] = useState<string[]>([]);
28+
29+
//handle expand toggle
30+
const toggleExpanded = (
31+
e: MouseEvent<HTMLButtonElement>,
32+
key: string
33+
) => {
34+
e.preventDefault();
35+
e.stopPropagation();
36+
if (!expanded.includes(key)) {
37+
setExpanded(expanded.concat(key));
38+
} else {
39+
setExpanded(expanded.filter(item => item !== key));
40+
}
41+
}
2742

2843
//set filter: pass it up to parent
2944
const setFilter = (
@@ -38,7 +53,7 @@ export default function Dropdown({
3853

3954
if (value) {
4055
const index = currentValues.indexOf(value);
41-
if (e.metaKey) {
56+
if (e.metaKey || e.ctrlKey) {
4257
if (index === -1) {
4358
currentValues.push(value);
4459
} else {
@@ -71,26 +86,45 @@ export default function Dropdown({
7186

7287
const renderDropdownItem = ({ key, name, slugs, children }: Index) => (
7388
<Fragment key={key}>
74-
<button
89+
<div
90+
className="tsml-dropdown__item"
7591
// @ts-expect-error TODO
7692
data-active={values.includes(key)}
77-
onClick={e => setFilter(e, filter, key)}
7893
>
79-
{name}
80-
<span
81-
aria-label={
82-
slugs.length === 1
83-
? strings.match_single
84-
: i18n(strings.match_multiple, {
85-
count: slugs.length,
86-
})
87-
}
88-
>
89-
{slugs.length}
90-
</span>
91-
</button>
94+
<button
95+
className="tsml-dropdown__button"
96+
onClick={e => setFilter(e, filter, key)}
97+
>
98+
{name}
99+
<span
100+
aria-label={
101+
slugs.length === 1
102+
? strings.match_single
103+
: i18n(strings.match_multiple, {
104+
count: slugs.length,
105+
})
106+
}
107+
>
108+
{slugs.length}
109+
</span>
110+
</button>
111+
{!!children?.length && (
112+
<button
113+
className="tsml-dropdown__expand"
114+
data-expanded={expanded.includes(key)}
115+
onClick={(e) => toggleExpanded(e, key)}
116+
aria-label={expanded.includes(key) ? strings.collapse : strings.expand}
117+
>
118+
</button>
119+
)}
120+
</div>
92121
{!!children?.length && (
93-
<div>{children.map(child => renderDropdownItem(child))}</div>
122+
<div
123+
className="tsml-dropdown__children"
124+
data-expanded={expanded.includes(key)}
125+
>
126+
{children.map(child => renderDropdownItem(child))}
127+
</div>
94128
)}
95129
</Fragment>
96130
);
@@ -117,14 +151,20 @@ export default function Dropdown({
117151
</button>
118152
<div
119153
aria-labelledby={filter}
154+
className="tsml-dropdown"
120155
style={{ display: open ? 'block' : 'none' }}
121156
>
122-
<button
157+
<div
123158
data-active={!values.length}
124-
onClick={e => setFilter(e, filter, undefined)}
125-
>
126-
{defaultValue}
127-
</button>
159+
className="tsml-dropdown__item"
160+
>
161+
<button
162+
className="tsml-dropdown__button"
163+
onClick={e => setFilter(e, filter, undefined)}
164+
>
165+
{defaultValue}
166+
</button>
167+
</div>
128168
{[
129169
options
130170
?.filter(option =>

src/i18n/en.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export const en: Translation = {
55
address: 'Address / Platform',
66
appointment: 'Appointment',
77
back_to_meetings: 'Back to Meetings',
8+
collapse: 'Collapse',
89
contact_email: 'Email %contact%',
910
contact_text: 'Text %contact%',
1011
contribute_with: 'Contribute with %service%',
@@ -25,6 +26,7 @@ export const en: Translation = {
2526
email_public_url: 'Public URL: %url%',
2627
email_subject: 'Meeting Feedback: %name%',
2728
evening: 'Evening',
29+
expand: 'Expand',
2830
feedback: 'Update Meeting Info',
2931
get_directions: 'Get Directions',
3032
in_progress_single: '1 meeting in progress',

src/i18n/es.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export const es: Translation = {
55
address: 'Dirección',
66
appointment: 'Cita',
77
back_to_meetings: 'Volver a las reuniones',
8+
collapse: 'Colapso',
89
contact_email: 'Correo a %contact%',
910
contact_text: 'Texto %contact%',
1011
contribute_with: 'Contribuya con %service%',
@@ -25,6 +26,7 @@ export const es: Translation = {
2526
email_public_url: 'URL pública: %url%',
2627
email_subject: 'Comentarios de la reunión: %name%',
2728
evening: 'Noche',
29+
expand: 'Expandir',
2830
feedback: 'Actualizar la información de la reunión',
2931
get_directions: 'Obtener las direcciones',
3032
in_progress_single: '1 reunión en curso',

src/i18n/fr.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export const fr: Translation = {
55
address: 'Adresse',
66
appointment: 'Rendez-vous',
77
back_to_meetings: 'Retour aux réunions',
8+
collapse: 'Développer',
89
contact_email: 'E-mail à %contact%',
910
contact_text: 'Texte %contact%',
1011
contribute_with: 'Contribuer avec %service%',
@@ -25,6 +26,7 @@ export const fr: Translation = {
2526
email_public_url: 'URL publique : %url%',
2627
email_subject: 'Commentaires sur la réunion : %name%',
2728
evening: 'Soir',
29+
expand: 'Effondrement',
2830
feedback: 'Mettre à jour les informations sur la réunion',
2931
get_directions: 'Obtenir des itinéraires',
3032
in_progress_single: '1 réunion en cours',

src/i18n/ja.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export const ja: Translation = {
55
address: '住所・プラットフォーム',
66
appointment: '予定',
77
back_to_meetings: 'ミーティング一覧へ戻る',
8+
collapse: "膨らむ",
89
contact_email: '%contact%にメール',
910
contact_text: '%contact%にテキスト',
1011
contribute_with: '%service% で献金する',
@@ -25,6 +26,7 @@ export const ja: Translation = {
2526
email_public_url: '公開URLの掲載依頼をメール: %url%',
2627
email_subject: 'メールする: %name%',
2728
evening: '夕方',
29+
expand: '倒れる',
2830
feedback: 'ミーティング情報の更新',
2931
get_directions: '行き方を調べる',
3032
in_progress_single: '1件のミーティングが進行中です',

src/i18n/nl.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export const nl: Translation = {
55
address: 'Addres',
66
appointment: 'Afspraak',
77
back_to_meetings: 'Terug naar Meetings',
8+
collapse: 'Instorting',
89
contact_email: 'E-mail %contact%',
910
contact_text: 'Tekst %contact%',
1011
contribute_with: 'Bijdragen aan %service%',
@@ -25,6 +26,7 @@ export const nl: Translation = {
2526
email_public_url: 'Publieke URL: %url%',
2627
email_subject: 'Meeting Feedback: %name%',
2728
evening: 'Avond',
29+
expand: 'Uitbreiden',
2830
feedback: 'Update Meeting Info',
2931
get_directions: 'Krijg Routebeschrijving',
3032
in_progress_single: '1 meeting bezig',

src/i18n/pt.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export const pt: Translation = {
55
address: 'Endereço / Plataforma',
66
appointment: 'Marcação',
77
back_to_meetings: 'Voltar às Reuniões',
8+
collapse: 'Colapso',
89
contact_email: 'Email %contact%',
910
contact_text: 'Texto %contact%',
1011
contribute_with: 'Contribuir com %service%',
@@ -25,6 +26,7 @@ export const pt: Translation = {
2526
email_public_url: 'URL Público: %url%',
2627
email_subject: 'Feedback da Reunião: %name%',
2728
evening: 'Fim do Dia',
29+
expand: 'Expandir',
2830
feedback: 'Atualizar Informações da Reunião',
2931
get_directions: 'Obter Direcções',
3032
in_progress_single: '1 reunião em progresso',

src/i18n/sk.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export const sk: Translation = {
55
address: 'Adresa / Platforma',
66
appointment: 'Stretnutie',
77
back_to_meetings: 'Späť na Stretnutia',
8+
collapse: 'Kolaps',
89
contact_email: 'Emailovať %contact%',
910
contact_text: 'Text %contact%',
1011
contribute_with: 'Prispejte spolu s %service%',
@@ -25,6 +26,7 @@ export const sk: Translation = {
2526
email_public_url: 'Verejná URL: %url%',
2627
email_subject: 'Spätná väzba na stretnutie: %name%',
2728
evening: 'Večer',
29+
expand: 'Rozšíriť',
2830
feedback: 'Aktualizovať informácie o stretnutí',
2931
get_directions: 'Zobraziť trasu',
3032
in_progress_single: '1 stretnutie práve prebieha',

0 commit comments

Comments
 (0)