From 84517d06a3d7948f6ed8fbf692323318a9df92eb Mon Sep 17 00:00:00 2001 From: Midas Date: Tue, 20 Jun 2023 09:22:25 +0100 Subject: [PATCH 1/3] Added feature to copy the list of availabilities --- .../AvailabilityViewer/AvailabilityViewer.tsx | 13 ++++++++++++- frontend/src/i18n/locales/en-GB/event.json | 8 +++++++- frontend/src/i18n/locales/en/event.json | 9 ++++++++- frontend/src/i18n/locales/pt-BR/event.json | 8 +++++++- frontend/src/i18n/locales/pt-PT/event.json | 7 ++++++- 5 files changed, 40 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/AvailabilityViewer/AvailabilityViewer.tsx b/frontend/src/components/AvailabilityViewer/AvailabilityViewer.tsx index 05f31e1..e667c41 100644 --- a/frontend/src/components/AvailabilityViewer/AvailabilityViewer.tsx +++ b/frontend/src/components/AvailabilityViewer/AvailabilityViewer.tsx @@ -101,7 +101,18 @@ const AvailabilityViewer = ({ times, people, table }: AvailabilityViewerProps) = people: peopleHere, }) }} + onMouseDown={e => { + setTooltip({ + anchor: e.currentTarget, + available: `${peopleHere.length} / ${filteredPeople.length} ${t('available')}`, + date: cell.label, + people: peopleHere, + }) + let text2Clipboard = t("copy.message") + cell.label + ":\n" + peopleHere.join(';\n') + ";"; + navigator.clipboard.writeText(text2Clipboard); + }} onMouseLeave={() => setTooltip(undefined)} + /> })} @@ -130,7 +141,7 @@ const AvailabilityViewer = ({ times, people, table }: AvailabilityViewerProps) = /> {t('group.info1')} - + {t('group.info3')} {people.length > 1 && <> {t('group.info2')}
diff --git a/frontend/src/i18n/locales/en-GB/event.json b/frontend/src/i18n/locales/en-GB/event.json index 1c76d6b..0db3146 100644 --- a/frontend/src/i18n/locales/en-GB/event.json +++ b/frontend/src/i18n/locales/en-GB/event.json @@ -49,7 +49,13 @@ "group": { "legend_tooltip": "Click to highlight highest availability", "info1": "Hover or tap the calendar below to see who is available", - "info2": "Click the names below to view people individually" + "info2": "Click the names below to view people individually", + "info3": "Click on a time slot to copy a list of people who are available then" + }, + + "copy": { + "alert": "List of available people copied to clipboard!", + "message": "List of available people at " }, "you": { diff --git a/frontend/src/i18n/locales/en/event.json b/frontend/src/i18n/locales/en/event.json index b86712d..e56cbef 100644 --- a/frontend/src/i18n/locales/en/event.json +++ b/frontend/src/i18n/locales/en/event.json @@ -49,7 +49,14 @@ "group": { "legend_tooltip": "Click to highlight highest availability", "info1": "Hover or tap the calendar below to see who is available", - "info2": "Click the names below to view people individually" + "info2": "Click the names below to view people individually", + "info3": "Click on a time slot to copy a list of people who are available then" + + }, + + "copy": { + "alert": "List of available people copied to clipboard!", + "message": "List of available people at " }, "you": { diff --git a/frontend/src/i18n/locales/pt-BR/event.json b/frontend/src/i18n/locales/pt-BR/event.json index 5c713c8..162a350 100644 --- a/frontend/src/i18n/locales/pt-BR/event.json +++ b/frontend/src/i18n/locales/pt-BR/event.json @@ -49,7 +49,13 @@ "group": { "legend_tooltip": "Clique para destacar o melhor tempo", "info1": "Passe o mouse ou toque o calendário pra ver quem está livre", - "info2": "Clique nos nomes pra ver a disponibilidade de cada um" + "info2": "Clique nos nomes pra ver a disponibilidade de cada um", + "info3": "Clica num slot para copiar uma lista das pessoas disponíveis nesse horário" + }, + + "copy": { + "alert": "Lista de pessoas disponíveis copiada!", + "message": "Pessoas diponíveis a " }, "you": { diff --git a/frontend/src/i18n/locales/pt-PT/event.json b/frontend/src/i18n/locales/pt-PT/event.json index 4867d47..0df2e3a 100644 --- a/frontend/src/i18n/locales/pt-PT/event.json +++ b/frontend/src/i18n/locales/pt-PT/event.json @@ -49,7 +49,12 @@ "group": { "legend_tooltip": "Clica para realçar as horas com maior disponibilidade", "info1": "Passa o cursor ou clica no calendário abaixo para ver quem está disponível", - "info2": "Clica nos nomes abaixo para ver a disponibilidade de cada pessoa" + "info2": "Clica nos nomes abaixo para ver a disponibilidade de cada pessoa", + "info3": "Clica num slot para copiar uma lista das pessoas disponíveis nesse horário" + }, + "copy": { + "alert": "Lista de pessoas disponíveis copiada!", + "message": "Pessoas diponíveis a " }, "you": { From e6ec03acff18b4638be18aadf9b7a3ebd20b2fc2 Mon Sep 17 00:00:00 2001 From: Midas Date: Tue, 20 Jun 2023 16:17:14 +0100 Subject: [PATCH 2/3] Some more fixes --- .../AvailabilityViewer/AvailabilityViewer.tsx | 13 +++---------- frontend/src/i18n/locales/en/event.json | 10 ++-------- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/frontend/src/components/AvailabilityViewer/AvailabilityViewer.tsx b/frontend/src/components/AvailabilityViewer/AvailabilityViewer.tsx index e667c41..3a20380 100644 --- a/frontend/src/components/AvailabilityViewer/AvailabilityViewer.tsx +++ b/frontend/src/components/AvailabilityViewer/AvailabilityViewer.tsx @@ -101,15 +101,9 @@ const AvailabilityViewer = ({ times, people, table }: AvailabilityViewerProps) = people: peopleHere, }) }} - onMouseDown={e => { - setTooltip({ - anchor: e.currentTarget, - available: `${peopleHere.length} / ${filteredPeople.length} ${t('available')}`, - date: cell.label, - people: peopleHere, - }) - let text2Clipboard = t("copy.message") + cell.label + ":\n" + peopleHere.join(';\n') + ";"; - navigator.clipboard.writeText(text2Clipboard); + onClick={() => { + const clipboardMessage = `${t('group.clipboard_message', { date: cell.label })}:\n${peopleHere.join(', ')}` + navigator.clipboard.writeText(clipboardMessage); }} onMouseLeave={() => setTooltip(undefined)} @@ -141,7 +135,6 @@ const AvailabilityViewer = ({ times, people, table }: AvailabilityViewerProps) = /> {t('group.info1')} - {t('group.info3')} {people.length > 1 && <> {t('group.info2')}
diff --git a/frontend/src/i18n/locales/en/event.json b/frontend/src/i18n/locales/en/event.json index e56cbef..5d691e2 100644 --- a/frontend/src/i18n/locales/en/event.json +++ b/frontend/src/i18n/locales/en/event.json @@ -48,15 +48,9 @@ "group": { "legend_tooltip": "Click to highlight highest availability", - "info1": "Hover or tap the calendar below to see who is available", + "info1": "Hover or tap the calendar below to see who is available, and click to copy details about a time slot", "info2": "Click the names below to view people individually", - "info3": "Click on a time slot to copy a list of people who are available then" - - }, - - "copy": { - "alert": "List of available people copied to clipboard!", - "message": "List of available people at " + "clipboard_message": "People available on {{date}}" }, "you": { From d394cf3cc4a52d46ede91c4012b794aa1ab553aa Mon Sep 17 00:00:00 2001 From: Benji Grant Date: Wed, 21 Jun 2023 01:33:54 +1000 Subject: [PATCH 3/3] Remove translations and semicolon --- .../components/AvailabilityViewer/AvailabilityViewer.tsx | 4 ++-- frontend/src/i18n/locales/en-GB/event.json | 8 +------- frontend/src/i18n/locales/pt-BR/event.json | 8 +------- frontend/src/i18n/locales/pt-PT/event.json | 7 +------ 4 files changed, 5 insertions(+), 22 deletions(-) diff --git a/frontend/src/components/AvailabilityViewer/AvailabilityViewer.tsx b/frontend/src/components/AvailabilityViewer/AvailabilityViewer.tsx index 3a20380..a2e9869 100644 --- a/frontend/src/components/AvailabilityViewer/AvailabilityViewer.tsx +++ b/frontend/src/components/AvailabilityViewer/AvailabilityViewer.tsx @@ -103,10 +103,9 @@ const AvailabilityViewer = ({ times, people, table }: AvailabilityViewerProps) = }} onClick={() => { const clipboardMessage = `${t('group.clipboard_message', { date: cell.label })}:\n${peopleHere.join(', ')}` - navigator.clipboard.writeText(clipboardMessage); + navigator.clipboard.writeText(clipboardMessage) }} onMouseLeave={() => setTooltip(undefined)} - /> })}
@@ -135,6 +134,7 @@ const AvailabilityViewer = ({ times, people, table }: AvailabilityViewerProps) = /> {t('group.info1')} + {people.length > 1 && <> {t('group.info2')}
diff --git a/frontend/src/i18n/locales/en-GB/event.json b/frontend/src/i18n/locales/en-GB/event.json index e784c62..b6656ae 100644 --- a/frontend/src/i18n/locales/en-GB/event.json +++ b/frontend/src/i18n/locales/en-GB/event.json @@ -49,13 +49,7 @@ "group": { "legend_tooltip": "Click to highlight highest availability", "info1": "Hover or tap the calendar below to see who is available", - "info2": "Click the names below to view people individually", - "info3": "Click on a time slot to copy a list of people who are available then" - }, - - "copy": { - "alert": "List of available people copied to clipboard!", - "message": "List of available people at " + "info2": "Click the names below to view people individually" }, "you": { diff --git a/frontend/src/i18n/locales/pt-BR/event.json b/frontend/src/i18n/locales/pt-BR/event.json index 162a350..5c713c8 100644 --- a/frontend/src/i18n/locales/pt-BR/event.json +++ b/frontend/src/i18n/locales/pt-BR/event.json @@ -49,13 +49,7 @@ "group": { "legend_tooltip": "Clique para destacar o melhor tempo", "info1": "Passe o mouse ou toque o calendário pra ver quem está livre", - "info2": "Clique nos nomes pra ver a disponibilidade de cada um", - "info3": "Clica num slot para copiar uma lista das pessoas disponíveis nesse horário" - }, - - "copy": { - "alert": "Lista de pessoas disponíveis copiada!", - "message": "Pessoas diponíveis a " + "info2": "Clique nos nomes pra ver a disponibilidade de cada um" }, "you": { diff --git a/frontend/src/i18n/locales/pt-PT/event.json b/frontend/src/i18n/locales/pt-PT/event.json index 0df2e3a..4867d47 100644 --- a/frontend/src/i18n/locales/pt-PT/event.json +++ b/frontend/src/i18n/locales/pt-PT/event.json @@ -49,12 +49,7 @@ "group": { "legend_tooltip": "Clica para realçar as horas com maior disponibilidade", "info1": "Passa o cursor ou clica no calendário abaixo para ver quem está disponível", - "info2": "Clica nos nomes abaixo para ver a disponibilidade de cada pessoa", - "info3": "Clica num slot para copiar uma lista das pessoas disponíveis nesse horário" - }, - "copy": { - "alert": "Lista de pessoas disponíveis copiada!", - "message": "Pessoas diponíveis a " + "info2": "Clica nos nomes abaixo para ver a disponibilidade de cada pessoa" }, "you": {