From 1d4aa7c53545f667e56556411caba9e1da450eac Mon Sep 17 00:00:00 2001 From: Mike Cao Date: Thu, 4 Aug 2022 03:56:30 -0700 Subject: [PATCH] Refactored website ordering feature. --- components/pages/Dashboard.js | 26 +++-- components/pages/DashboardEdit.js | 100 ++++++++++++++++++ components/pages/DashboardEdit.module.css | 34 ++++++ components/pages/WebsiteList.js | 99 +++-------------- components/pages/WebsiteList.module.css | 9 -- .../settings/DashboardSettingsButton.js | 47 +++----- components/settings/WebsiteSettings.js | 13 +-- lang/ar-SA.json | 1 + lang/bn-BD.json | 1 + lang/ca-ES.json | 1 + lang/cs-CZ.json | 1 + lang/da-DK.json | 1 + lang/de-DE.json | 1 + lang/el-GR.json | 1 + lang/en-GB.json | 1 + lang/en-US.json | 4 +- lang/es-MX.json | 1 + lang/fa-IR.json | 1 + lang/fi-FI.json | 1 + lang/fo-FO.json | 1 + lang/fr-FR.json | 1 + lang/ga-ES.json | 1 + lang/he-IL.json | 1 + lang/hi-IN.json | 1 + lang/hu-HU.json | 1 + lang/id-ID.json | 1 + lang/it-IT.json | 1 + lang/ja-JP.json | 1 + lang/ko-KR.json | 1 + lang/lt-LT.json | 1 + lang/mn-MN.json | 1 + lang/ms-MY.json | 1 + lang/nb-NO.json | 1 + lang/nl-NL.json | 1 + lang/pl-PL.json | 1 + lang/pt-BR.json | 1 + lang/pt-PT.json | 1 + lang/ro-RO.json | 1 + lang/ru-RU.json | 1 + lang/sk-SK.json | 1 + lang/sl-SI.json | 1 + lang/sv-SE.json | 1 + lang/ta-IN.json | 1 + lang/th-TH.json | 1 + lang/tr-TR.json | 1 + lang/uk-UA.json | 1 + lang/ur-PK.json | 1 + lang/vi-VN.json | 1 + lang/zh-CN.json | 1 + lang/zh-TW.json | 1 + lib/web.js | 15 ++- public/intl/messages/ar-SA.json | 6 ++ public/intl/messages/bn-BD.json | 6 ++ public/intl/messages/ca-ES.json | 6 ++ public/intl/messages/cs-CZ.json | 6 ++ public/intl/messages/da-DK.json | 6 ++ public/intl/messages/de-DE.json | 6 ++ public/intl/messages/el-GR.json | 6 ++ public/intl/messages/en-GB.json | 6 ++ public/intl/messages/en-US.json | 6 ++ public/intl/messages/es-MX.json | 6 ++ public/intl/messages/fa-IR.json | 6 ++ public/intl/messages/fi-FI.json | 6 ++ public/intl/messages/fo-FO.json | 6 ++ public/intl/messages/fr-FR.json | 6 ++ public/intl/messages/ga-ES.json | 6 ++ public/intl/messages/he-IL.json | 6 ++ public/intl/messages/hi-IN.json | 6 ++ public/intl/messages/hu-HU.json | 6 ++ public/intl/messages/id-ID.json | 6 ++ public/intl/messages/it-IT.json | 6 ++ public/intl/messages/ja-JP.json | 6 ++ public/intl/messages/ko-KR.json | 6 ++ public/intl/messages/lt-LT.json | 6 ++ public/intl/messages/mn-MN.json | 6 ++ public/intl/messages/ms-MY.json | 6 ++ public/intl/messages/nb-NO.json | 6 ++ public/intl/messages/nl-NL.json | 6 ++ public/intl/messages/pl-PL.json | 6 ++ public/intl/messages/pt-BR.json | 6 ++ public/intl/messages/pt-PT.json | 6 ++ public/intl/messages/ro-RO.json | 6 ++ public/intl/messages/ru-RU.json | 6 ++ public/intl/messages/sk-SK.json | 6 ++ public/intl/messages/sl-SI.json | 6 ++ public/intl/messages/sv-SE.json | 6 ++ public/intl/messages/ta-IN.json | 6 ++ public/intl/messages/th-TH.json | 6 ++ public/intl/messages/tr-TR.json | 6 ++ public/intl/messages/uk-UA.json | 6 ++ public/intl/messages/ur-PK.json | 6 ++ public/intl/messages/vi-VN.json | 6 ++ public/intl/messages/zh-CN.json | 6 ++ public/intl/messages/zh-TW.json | 6 ++ store/app.js | 24 +---- store/dashboard.js | 21 ++++ 96 files changed, 518 insertions(+), 174 deletions(-) create mode 100644 components/pages/DashboardEdit.js create mode 100644 components/pages/DashboardEdit.module.css create mode 100644 store/dashboard.js diff --git a/components/pages/Dashboard.js b/components/pages/Dashboard.js index 31931086..f2384487 100644 --- a/components/pages/Dashboard.js +++ b/components/pages/Dashboard.js @@ -1,5 +1,5 @@ import { useState } from 'react'; -import { FormattedMessage } from 'react-intl'; +import { defineMessages, useIntl } from 'react-intl'; import { useRouter } from 'next/router'; import Page from 'components/layout/Page'; import PageHeader from 'components/layout/PageHeader'; @@ -7,19 +7,24 @@ import WebsiteList from 'components/pages/WebsiteList'; import Button from 'components/common/Button'; import DashboardSettingsButton from 'components/settings/DashboardSettingsButton'; import useFetch from 'hooks/useFetch'; -import useStore from 'store/app'; +import useDashboard from 'store/dashboard'; +import DashboardEdit from './DashboardEdit'; import styles from './WebsiteList.module.css'; -const selector = state => state.dashboard; +const messages = defineMessages({ + dashboard: { id: 'label.dashboard', defaultMessage: 'Dashboard' }, + more: { id: 'label.more', defaultMessage: 'More' }, +}); export default function Dashboard() { const router = useRouter(); const { id } = router.query; const userId = id?.[0]; - const store = useStore(selector); - const { showCharts, limit } = store; + const dashboard = useDashboard(); + const { showCharts, limit, editing } = dashboard; const [max, setMax] = useState(limit); const { data } = useFetch('/websites', { params: { user_id: userId } }); + const { formatMessage } = useIntl(); function handleMore() { setMax(max + limit); @@ -32,15 +37,14 @@ export default function Dashboard() { return ( -
- -
- +
{formatMessage(messages.dashboard)}
+ {!editing && }
- + {editing && } + {!editing && } {max < data.length && ( )}
diff --git a/components/pages/DashboardEdit.js b/components/pages/DashboardEdit.js new file mode 100644 index 00000000..f8e9aeee --- /dev/null +++ b/components/pages/DashboardEdit.js @@ -0,0 +1,100 @@ +import { useState } from 'react'; +import { defineMessages, useIntl } from 'react-intl'; +import { DragDropContext, Draggable, Droppable } from 'react-beautiful-dnd'; +import useDashboard, { saveDashboard } from 'store/dashboard'; +import Button from 'components/common/Button'; +import { useMemo } from 'react'; +import { orderByWebsiteMap } from 'lib/format'; +import styles from './DashboardEdit.module.css'; + +const messages = defineMessages({ + save: { id: 'label.save', defaultMessage: 'Save' }, + reset: { id: 'label.reset', defaultMessage: 'Reset' }, + cancel: { id: 'label.cancel', defaultMessage: 'Cancel' }, +}); + +const dragId = 'dashboard-website-ordering'; + +export default function DashboardEdit({ data: websites }) { + const settings = useDashboard(); + const { websiteOrder } = settings; + const { formatMessage } = useIntl(); + const [order, setOrder] = useState(websiteOrder); + + const ordered = useMemo(() => orderByWebsiteMap(websites, order), [websites, order]); + + console.log({ order, ordered }); + + function handleWebsiteDrag({ destination, source }) { + if (!destination || destination.index === source.index) return; + + const orderedWebsites = [...ordered]; + const [removed] = orderedWebsites.splice(source.index, 1); + orderedWebsites.splice(destination.index, 0, removed); + + setOrder( + orderedWebsites.map((i, k) => ({ [i.website_uuid]: k })).reduce((a, b) => ({ ...a, ...b })), + ); + } + + function handleSave() { + saveDashboard({ + editing: false, + websiteOrder: order, + }); + } + + function handleCancel() { + saveDashboard({ editing: false }); + } + + function handleReset() { + setOrder({}); + saveDashboard({ websiteOrder: {} }); + } + + return ( + <> +
+ + + +
+
+ + + {(provided, snapshot) => ( +
+ {ordered.map(({ website_id, name, domain }, index) => ( + + {provided => ( +
+

{name}

+

{domain}

+
+ )} +
+ ))} +
+ )} +
+
+
+ + ); +} diff --git a/components/pages/DashboardEdit.module.css b/components/pages/DashboardEdit.module.css new file mode 100644 index 00000000..523abc43 --- /dev/null +++ b/components/pages/DashboardEdit.module.css @@ -0,0 +1,34 @@ +.buttons { + display: flex; + justify-content: flex-end; + gap: 10px; + margin-bottom: 20px; +} + +.item { + padding: 20px; + border-radius: 5px; + border: 1px solid var(--gray300); +} + +.item + .item { + margin-top: 10px; +} + +.item h1 { + font-weight: 600; + font-size: 16px; +} + +.item h2 { + font-size: 14px; + color: var(--gray700); +} + +.dragActive { + cursor: grab; +} + +.dragActive:active { + cursor: grabbing; +} diff --git a/components/pages/WebsiteList.js b/components/pages/WebsiteList.js index 12e2f7d9..46011198 100644 --- a/components/pages/WebsiteList.js +++ b/components/pages/WebsiteList.js @@ -1,4 +1,3 @@ -import { DragDropContext, Draggable, Droppable } from 'react-beautiful-dnd'; import { FormattedMessage } from 'react-intl'; import Link from 'components/common/Link'; import WebsiteChart from 'components/metrics/WebsiteChart'; @@ -6,37 +5,14 @@ import Page from 'components/layout/Page'; import EmptyPlaceholder from 'components/common/EmptyPlaceholder'; import Arrow from 'assets/arrow-right.svg'; import styles from './WebsiteList.module.css'; +import useDashboard from 'store/dashboard'; import { orderByWebsiteMap } from 'lib/format'; import { useMemo } from 'react'; -import useStore, { setDashboard } from 'store/app'; -const selector = state => state.dashboard; +export default function WebsiteList({ data, showCharts, limit }) { + const { websiteOrder } = useDashboard(); -export default function WebsiteList({ websites, showCharts, limit }) { - const store = useStore(selector); - const { websiteOrdering, changeOrderMode } = store; - - const ordered = useMemo( - () => orderByWebsiteMap(websites, websiteOrdering), - [websites, websiteOrdering], - ); - - const dragId = 'dashboard-website-ordering'; - - function handleWebsiteDrag({ destination, source }) { - if (!destination || destination.index === source.index) return; - - const orderedWebsites = [...ordered]; - const [removed] = orderedWebsites.splice(source.index, 1); - orderedWebsites.splice(destination.index, 0, removed); - - setDashboard({ - ...store, - websiteOrdering: orderedWebsites - .map((i, k) => ({ [i.website_uuid]: k })) - .reduce((a, b) => ({ ...a, ...b })), - }); - } + const websites = useMemo(() => orderByWebsiteMap(data, websiteOrder), [data, websiteOrder]); if (websites.length === 0) { return ( @@ -58,60 +34,19 @@ export default function WebsiteList({ websites, showCharts, limit }) { } return ( -
- {changeOrderMode ? ( - - - {(provided, snapshot) => ( -
- {ordered.map(({ website_id, name, domain }, index) => - index < limit ? ( - - {provided => ( -
- -
- )} -
- ) : null, - )} -
- )} -
-
- ) : ( - ordered.map(({ website_id, name, domain }, index) => - index < limit ? ( -
- -
- ) : null, - ) +
+ {websites.map(({ website_id, name, domain }, index) => + index < limit ? ( +
+ +
+ ) : null, )}
); diff --git a/components/pages/WebsiteList.module.css b/components/pages/WebsiteList.module.css index 9b5e6968..fc6a94c2 100644 --- a/components/pages/WebsiteList.module.css +++ b/components/pages/WebsiteList.module.css @@ -9,12 +9,3 @@ border-bottom: 0; margin-bottom: 20px; } - -.websiteDragActive { - opacity: 0.6; - cursor: grab; -} - -.websiteDragActive:active { - cursor: grabbing; -} diff --git a/components/settings/DashboardSettingsButton.js b/components/settings/DashboardSettingsButton.js index 5425bca5..43679534 100644 --- a/components/settings/DashboardSettingsButton.js +++ b/components/settings/DashboardSettingsButton.js @@ -1,57 +1,40 @@ import React from 'react'; -import { FormattedMessage } from 'react-intl'; +import { defineMessages, useIntl } from 'react-intl'; import MenuButton from 'components/common/MenuButton'; import Gear from 'assets/gear.svg'; -import useStore, { setDashboard } from 'store/app'; -import Button from 'components/common/Button'; -import Check from 'assets/check.svg'; -import styles from './DashboardSettingsButton.module.css'; +import { saveDashboard } from 'store/dashboard'; -const selector = state => state.dashboard; +const messages = defineMessages({ + toggleCharts: { id: 'message.toggle-charts', defaultMessage: 'Toggle charts' }, + editDashboard: { id: 'message.edit-dashboard', defaultMessage: 'Edit dashboard' }, +}); export default function DashboardSettingsButton() { - const settings = useStore(selector); + const { formatMessage } = useIntl(); const menuOptions = [ { - label: , + label: formatMessage(messages.toggleCharts), value: 'charts', }, { - label: , + label: formatMessage(messages.editDashboard), value: 'order', }, ]; function handleSelect(value) { if (value === 'charts') { - setDashboard({ ...settings, showCharts: !settings.showCharts }); + saveDashboard(state => { + const bs = { showCharts: !state.showCharts }; + console.log('WTF', { state, bs }); + return bs; + }); } if (value === 'order') { - setDashboard({ ...settings, changeOrderMode: !settings.changeOrderMode }); + saveDashboard({ editing: true }); } - //setDashboard(value); } - function handleExitChangeOrderMode() { - setDashboard({ ...settings, changeOrderMode: !settings.changeOrderMode }); - } - - function resetWebsiteOrder() { - setDashboard({ ...settings, websiteOrdering: {} }); - } - - if (settings.changeOrderMode) - return ( -
- - -
- ); - return } options={menuOptions} onSelect={handleSelect} hideLabel />; } diff --git a/components/settings/WebsiteSettings.js b/components/settings/WebsiteSettings.js index f5cd31e6..451be47f 100644 --- a/components/settings/WebsiteSettings.js +++ b/components/settings/WebsiteSettings.js @@ -1,4 +1,4 @@ -import React, { useMemo, useState } from 'react'; +import React, { useState } from 'react'; import { FormattedMessage } from 'react-intl'; import classNames from 'classnames'; import Link from 'components/common/Link'; @@ -24,12 +24,8 @@ import Code from 'assets/code.svg'; import LinkIcon from 'assets/link.svg'; import useFetch from 'hooks/useFetch'; import useUser from 'hooks/useUser'; -import { orderByWebsiteMap } from 'lib/format'; -import useStore from 'store/app'; import styles from './WebsiteSettings.module.css'; -const selector = state => state.dashboard; - export default function WebsiteSettings() { const { user } = useUser(); const [editWebsite, setEditWebsite] = useState(); @@ -41,13 +37,8 @@ export default function WebsiteSettings() { const [saved, setSaved] = useState(0); const [message, setMessage] = useState(); - const store = useStore(selector); - const { websiteOrdering } = store; - const { data } = useFetch('/websites', { params: { include_all: !!user?.is_admin } }, [saved]); - const ordered = useMemo(() => orderByWebsiteMap(data, websiteOrdering), [data, websiteOrdering]); - const Buttons = row => ( {row.share_id && ( @@ -196,7 +187,7 @@ export default function WebsiteSettings() { - +
{editWebsite && ( }> diff --git a/lang/ar-SA.json b/lang/ar-SA.json index 137c726f..a970e5e1 100644 --- a/lang/ar-SA.json +++ b/lang/ar-SA.json @@ -68,6 +68,7 @@ "message.confirm-reset": "هل أنت متأكد من اعادة تعيين الإحصائيات لـ {target}؟", "message.copied": "تم النسخ!", "message.delete-warning": "كافة البيانات المرتبطة سيم حذفها ايضا.", + "message.edit-dashboard": "Edit dashboard", "message.failure": "حدث خطأ ما.", "message.get-share-url": "احصل على رابط المشاركة", "message.get-tracking-code": "احصل على كود التتبع", diff --git a/lang/bn-BD.json b/lang/bn-BD.json index 6d4479ff..98199a04 100644 --- a/lang/bn-BD.json +++ b/lang/bn-BD.json @@ -68,6 +68,7 @@ "message.confirm-reset": "আপনি কি নিশ্চিত যে আপনি {target} এর পরিসংখ্যান পুনরায় সেট করতে চান?", "message.copied": "কপি হয়েছে", "message.delete-warning": "সমস্ত সম্পর্কিত ডেটা পাশাপাশি মুছে ফেলা হবে।", + "message.edit-dashboard": "Edit dashboard", "message.failure": "কিছু ভুল হয়েছে।", "message.get-share-url": "শেয়ার ইউআরএল", "message.get-tracking-code": "ট্র্যাকিং কোড পান", diff --git a/lang/ca-ES.json b/lang/ca-ES.json index f822f9f7..db83685b 100644 --- a/lang/ca-ES.json +++ b/lang/ca-ES.json @@ -68,6 +68,7 @@ "message.confirm-reset": "Segur que vols restablir les estadístiques de {target}?", "message.copied": "S'ha copiat", "message.delete-warning": "També s'esborraran totes les dades relacionades.", + "message.edit-dashboard": "Edit dashboard", "message.failure": "S'ha produït un error.", "message.get-share-url": "Obté l'enllaç per compartir", "message.get-tracking-code": "Obté el codi de seguiment", diff --git a/lang/cs-CZ.json b/lang/cs-CZ.json index 165f2512..345d25b6 100644 --- a/lang/cs-CZ.json +++ b/lang/cs-CZ.json @@ -68,6 +68,7 @@ "message.confirm-reset": "Are your sure you want to reset {target}'s statistics?", "message.copied": "Zkopírováno!", "message.delete-warning": "Všechna související data budou také smazána.", + "message.edit-dashboard": "Edit dashboard", "message.failure": "Něco se pokazilo.", "message.get-share-url": "Získat sdílené URL", "message.get-tracking-code": "Získat měřící kód", diff --git a/lang/da-DK.json b/lang/da-DK.json index 3621f63b..75507b0b 100644 --- a/lang/da-DK.json +++ b/lang/da-DK.json @@ -68,6 +68,7 @@ "message.confirm-reset": "Er du sikker på at du ville nulstille {target}'s statistikker?", "message.copied": "Kopieret!", "message.delete-warning": "Alle tilknyttede data slettes også.", + "message.edit-dashboard": "Edit dashboard", "message.failure": "Noget gik galt.", "message.get-share-url": "Få delings-URL", "message.get-tracking-code": "Få sporingskode", diff --git a/lang/de-DE.json b/lang/de-DE.json index ee0790b4..90b7d6a7 100644 --- a/lang/de-DE.json +++ b/lang/de-DE.json @@ -68,6 +68,7 @@ "message.confirm-reset": "Sind Sie sicher, dass Sie die Statistiken von {target} zurücksetzen wollen?", "message.copied": "In Zwischenablage kopiert!", "message.delete-warning": "Alle zugehörigen Daten werden ebenfalls gelöscht.", + "message.edit-dashboard": "Edit dashboard", "message.failure": "Es ist ein Fehler aufgetreten.", "message.get-share-url": "Freigabe-URL abrufen", "message.get-tracking-code": "Erstelle Tracking Kennung", diff --git a/lang/el-GR.json b/lang/el-GR.json index e82f9330..6719a215 100644 --- a/lang/el-GR.json +++ b/lang/el-GR.json @@ -68,6 +68,7 @@ "message.confirm-reset": "Are your sure you want to reset {target}'s statistics?", "message.copied": "Αντιγράφηκε!", "message.delete-warning": "Όλα τα σχετικά δεδομένα θα διαγραφούν επίσης.", + "message.edit-dashboard": "Edit dashboard", "message.failure": "Κάτι πήγε στραβά.", "message.get-share-url": "Λήψη URL κοινής χρήσης", "message.get-tracking-code": "Λήψη κώδικα παρακολούθησης", diff --git a/lang/en-GB.json b/lang/en-GB.json index 7819d5fb..aede59bd 100644 --- a/lang/en-GB.json +++ b/lang/en-GB.json @@ -68,6 +68,7 @@ "message.confirm-reset": "Are you sure you want to reset {target}'s statistics?", "message.copied": "Copied!", "message.delete-warning": "All associated data will be deleted as well.", + "message.edit-dashboard": "Edit dashboard", "message.failure": "Something went wrong.", "message.get-share-url": "Get share URL", "message.get-tracking-code": "Get tracking code", diff --git a/lang/en-US.json b/lang/en-US.json index f35005ad..aede59bd 100644 --- a/lang/en-US.json +++ b/lang/en-US.json @@ -22,10 +22,8 @@ "label.delete-website": "Delete website", "label.dismiss": "Dismiss", "label.domain": "Domain", - "label.done": "Done", "label.edit": "Edit", "label.edit-account": "Edit account", - "label.edit-dashboard": "Edit dashboard", "label.edit-website": "Edit website", "label.enable-share-url": "Enable share URL", "label.invalid": "Invalid", @@ -49,7 +47,6 @@ "label.refresh": "Refresh", "label.required": "Required", "label.reset": "Reset", - "label.reset-order": "Reset order", "label.reset-website": "Reset statistics", "label.save": "Save", "label.settings": "Settings", @@ -71,6 +68,7 @@ "message.confirm-reset": "Are you sure you want to reset {target}'s statistics?", "message.copied": "Copied!", "message.delete-warning": "All associated data will be deleted as well.", + "message.edit-dashboard": "Edit dashboard", "message.failure": "Something went wrong.", "message.get-share-url": "Get share URL", "message.get-tracking-code": "Get tracking code", diff --git a/lang/es-MX.json b/lang/es-MX.json index 115efc2c..a8babd66 100644 --- a/lang/es-MX.json +++ b/lang/es-MX.json @@ -68,6 +68,7 @@ "message.confirm-reset": "¿Seguro que deseas restablecer las estadísticas de {target}?", "message.copied": "¡Copiado!", "message.delete-warning": "Toda la información relacionada será eliminada.", + "message.edit-dashboard": "Edit dashboard", "message.failure": "Algo falló.", "message.get-share-url": "Obtener URL para compartir", "message.get-tracking-code": "Obtener código de rastreo", diff --git a/lang/fa-IR.json b/lang/fa-IR.json index af456c9a..e6c6eb36 100644 --- a/lang/fa-IR.json +++ b/lang/fa-IR.json @@ -68,6 +68,7 @@ "message.confirm-reset": "آیا از بازنشانی آمار {target} مطمئن هستید?", "message.copied": "کپی شد!", "message.delete-warning": "همه‌ی داده‌های مرتبط هم حذف خواهد شد.", + "message.edit-dashboard": "Edit dashboard", "message.failure": "مشکلی پیش آمده است.", "message.get-share-url": "دریافت URL برای اشتراک گذاری", "message.get-tracking-code": "گرفتن کد رهگیری", diff --git a/lang/fi-FI.json b/lang/fi-FI.json index e56ead62..4d987fe5 100644 --- a/lang/fi-FI.json +++ b/lang/fi-FI.json @@ -68,6 +68,7 @@ "message.confirm-reset": "Haluatko varmasti poistaa sivuston {target} tilastot?", "message.copied": "Kopioitu!", "message.delete-warning": "Kaikki siihen liittyvät tiedot poistetaan.", + "message.edit-dashboard": "Edit dashboard", "message.failure": "Jotain meni pieleen.", "message.get-share-url": "Hanki jakamisen URL-osoite", "message.get-tracking-code": "Hanki seurantakoodi", diff --git a/lang/fo-FO.json b/lang/fo-FO.json index 3d52dd2e..040b0c56 100644 --- a/lang/fo-FO.json +++ b/lang/fo-FO.json @@ -68,6 +68,7 @@ "message.confirm-reset": "Are your sure you want to reset {target}'s statistics?", "message.copied": "Avrita!", "message.delete-warning": "Øll data ið er knýtt at verður eisini strika.", + "message.edit-dashboard": "Edit dashboard", "message.failure": "Okkurt bleiv gali.", "message.get-share-url": "Fá leinku sum tú kanst deila", "message.get-tracking-code": "Fá sporings kotu", diff --git a/lang/fr-FR.json b/lang/fr-FR.json index 2c3d4802..b35a2c90 100644 --- a/lang/fr-FR.json +++ b/lang/fr-FR.json @@ -68,6 +68,7 @@ "message.confirm-reset": "Êtes-vous sûr de vouloir réinistialiser les statistiques de {target} ?", "message.copied": "Copié !", "message.delete-warning": "Toutes les données associées seront également supprimées.", + "message.edit-dashboard": "Edit dashboard", "message.failure": "Un problème est survenu.", "message.get-share-url": "Obtenir l'URL de partage", "message.get-tracking-code": "Obtenir le code de suivi", diff --git a/lang/ga-ES.json b/lang/ga-ES.json index 4c5a45c1..bb54572f 100644 --- a/lang/ga-ES.json +++ b/lang/ga-ES.json @@ -68,6 +68,7 @@ "message.confirm-reset": "Tes a certeza de querer restablecer as estatísticas de {target}?", "message.copied": "Copiado!", "message.delete-warning": "Tamén serán borrados tódolos datos asociados.", + "message.edit-dashboard": "Edit dashboard", "message.failure": "Houbo un fallo.", "message.get-share-url": "Obter URL de compartición", "message.get-tracking-code": "Obter código de seguimento", diff --git a/lang/he-IL.json b/lang/he-IL.json index f333e3e9..64f3880b 100644 --- a/lang/he-IL.json +++ b/lang/he-IL.json @@ -68,6 +68,7 @@ "message.confirm-reset": "Are your sure you want to reset {target}'s statistics?", "message.copied": "הועתק!", "message.delete-warning": "כל המידע המקושר יימחק", + "message.edit-dashboard": "Edit dashboard", "message.failure": "משהו השתבש", "message.get-share-url": "קבלת URL שיתוף", "message.get-tracking-code": "קבלת קוד מעקב", diff --git a/lang/hi-IN.json b/lang/hi-IN.json index fe57c6b3..b9837c9b 100644 --- a/lang/hi-IN.json +++ b/lang/hi-IN.json @@ -68,6 +68,7 @@ "message.confirm-reset": "Are your sure you want to reset {target}'s statistics?", "message.copied": "कॉपी हो गया!", "message.delete-warning": "सभी संबद्ध डेटा को भी हटा दिया जाएगा।", + "message.edit-dashboard": "Edit dashboard", "message.failure": "कुछ गलत हो गया।", "message.get-share-url": "शेयर URL प्राप्त करें", "message.get-tracking-code": "ट्रैकिंग कोड प्राप्त करें", diff --git a/lang/hu-HU.json b/lang/hu-HU.json index 5057a2dc..1a0b376d 100644 --- a/lang/hu-HU.json +++ b/lang/hu-HU.json @@ -68,6 +68,7 @@ "message.confirm-reset": "Are your sure you want to reset {target}'s statistics?", "message.copied": "Kimásolva!", "message.delete-warning": "Minden társított adat törlésre kerül.", + "message.edit-dashboard": "Edit dashboard", "message.failure": "Valami baj történt.", "message.get-share-url": "Megosztási URL kimásolása", "message.get-tracking-code": "Követési kód kimásolása", diff --git a/lang/id-ID.json b/lang/id-ID.json index 4b08ed95..3a47dacb 100644 --- a/lang/id-ID.json +++ b/lang/id-ID.json @@ -68,6 +68,7 @@ "message.confirm-reset": "Anda yakin ingin mengatur ulang statistik {target}?", "message.copied": "Tersalin!", "message.delete-warning": "Semua data terkait juga akan dihapus.", + "message.edit-dashboard": "Edit dashboard", "message.failure": "Ada yang salah.", "message.get-share-url": "Dapatkan URL berbagi", "message.get-tracking-code": "Dapatkan kode pelacakan", diff --git a/lang/it-IT.json b/lang/it-IT.json index c3acc7ee..dbc9f836 100644 --- a/lang/it-IT.json +++ b/lang/it-IT.json @@ -68,6 +68,7 @@ "message.confirm-reset": "Sei sicuro di voler azzerare le statistiche di {target}?", "message.copied": "Copiato!", "message.delete-warning": "Saranno eliminati anche tutti i dati associati.", + "message.edit-dashboard": "Edit dashboard", "message.failure": "Si è verificato un errore.", "message.get-share-url": "Ottieni l'URL di condivisione", "message.get-tracking-code": "Ottieni il codice di tracking", diff --git a/lang/ja-JP.json b/lang/ja-JP.json index cdf8f9c2..8aa07253 100644 --- a/lang/ja-JP.json +++ b/lang/ja-JP.json @@ -68,6 +68,7 @@ "message.confirm-reset": "Are your sure you want to reset {target}'s statistics?", "message.copied": "コピーしました!", "message.delete-warning": "関連するすべてのデータも削除されます。", + "message.edit-dashboard": "Edit dashboard", "message.failure": "問題が発生しました。", "message.get-share-url": "共有リンクを取得", "message.get-tracking-code": "トラッキングコードを取得", diff --git a/lang/ko-KR.json b/lang/ko-KR.json index 6ec9556d..2ee11335 100644 --- a/lang/ko-KR.json +++ b/lang/ko-KR.json @@ -68,6 +68,7 @@ "message.confirm-reset": "Are your sure you want to reset {target}'s statistics?", "message.copied": "복사했습니다!", "message.delete-warning": "관련된 모든 데이터도 삭제됩니다.", + "message.edit-dashboard": "Edit dashboard", "message.failure": "오류가 발생하였습니다.", "message.get-share-url": "공유 URL 가져오기", "message.get-tracking-code": "추적 코드 가져오기", diff --git a/lang/lt-LT.json b/lang/lt-LT.json index 53c1d371..69e70894 100644 --- a/lang/lt-LT.json +++ b/lang/lt-LT.json @@ -68,6 +68,7 @@ "message.confirm-reset": "Are esate tikri, jog norite atstatyti svetainės {target} statistikos duomenis?", "message.copied": "Nukopijuota!", "message.delete-warning": "Visi susiję duomenys taip pat bus ištrinti.", + "message.edit-dashboard": "Edit dashboard", "message.failure": "Kažkas įvyko ne taip.", "message.get-share-url": "Gauti bendrinimo nuorodą", "message.get-tracking-code": "Gauti sekimo kodą", diff --git a/lang/mn-MN.json b/lang/mn-MN.json index dccd18fc..5a88db57 100644 --- a/lang/mn-MN.json +++ b/lang/mn-MN.json @@ -68,6 +68,7 @@ "message.confirm-reset": "Are your sure you want to reset {target}'s statistics?", "message.copied": "Хуулсан!", "message.delete-warning": "Үүнтэй холбоотой бүх өгөгдөл устах болно.", + "message.edit-dashboard": "Edit dashboard", "message.failure": "Ямар нэг зүйл буруу боллоо.", "message.get-share-url": "Хуваалцах холбоос авах", "message.get-tracking-code": "Мөрдөх код авах", diff --git a/lang/ms-MY.json b/lang/ms-MY.json index c61085e5..36776d23 100644 --- a/lang/ms-MY.json +++ b/lang/ms-MY.json @@ -68,6 +68,7 @@ "message.confirm-reset": "Are your sure you want to reset {target}'s statistics?", "message.copied": "Disalin!", "message.delete-warning": "Semua data yang berkaitan juga akan dihapuskan.", + "message.edit-dashboard": "Edit dashboard", "message.failure": "Ada yang tidak kena.", "message.get-share-url": "Dapatkan URL berkongsi", "message.get-tracking-code": "Dapatkan kod penjejakan", diff --git a/lang/nb-NO.json b/lang/nb-NO.json index a997a897..346859c3 100644 --- a/lang/nb-NO.json +++ b/lang/nb-NO.json @@ -68,6 +68,7 @@ "message.confirm-reset": "Er du sikker på at du vil nullstille {target}'s statistikk?", "message.copied": "Kopiert!", "message.delete-warning": "Alle tilknyttede data slettes også.", + "message.edit-dashboard": "Edit dashboard", "message.failure": "Noe gikk galt.", "message.get-share-url": "Få delings-URL", "message.get-tracking-code": "Få sporingskode", diff --git a/lang/nl-NL.json b/lang/nl-NL.json index 4f332c72..27cc1bec 100644 --- a/lang/nl-NL.json +++ b/lang/nl-NL.json @@ -68,6 +68,7 @@ "message.confirm-reset": "Weet je zeker dat je de statistieken van {target} opnieuw wilt instellen?", "message.copied": "Gekopiëerd!", "message.delete-warning": "Alle verwante gegezens zullen ook verwijderd worden.", + "message.edit-dashboard": "Edit dashboard", "message.failure": "Er is iets misgegaan.", "message.get-share-url": "Openbare URL", "message.get-tracking-code": "Tracking code", diff --git a/lang/pl-PL.json b/lang/pl-PL.json index 810df54f..e80609f0 100644 --- a/lang/pl-PL.json +++ b/lang/pl-PL.json @@ -68,6 +68,7 @@ "message.confirm-reset": "Czy na pewno chcesz zresetować statystyki {target}?", "message.copied": "Skopiowano!", "message.delete-warning": "Wszystkie powiązane dane również zostaną usunięte.", + "message.edit-dashboard": "Edit dashboard", "message.failure": "Coś poszło nie tak.", "message.get-share-url": "Uzyskaj adres URL udostępniania", "message.get-tracking-code": "Pobierz kod śledzenia", diff --git a/lang/pt-BR.json b/lang/pt-BR.json index d545adeb..bb3a7e57 100644 --- a/lang/pt-BR.json +++ b/lang/pt-BR.json @@ -68,6 +68,7 @@ "message.confirm-reset": "Você tem certeza que deseja redefinir as estatísticas de {target}?", "message.copied": "Copiado!", "message.delete-warning": "Todos os dados associados também serão eliminados.", + "message.edit-dashboard": "Edit dashboard", "message.failure": "Ocorreu um erro.", "message.get-share-url": "Obter link de compartilhamento", "message.get-tracking-code": "Obter código de rastreamento", diff --git a/lang/pt-PT.json b/lang/pt-PT.json index 9eaabbc9..33dd3060 100644 --- a/lang/pt-PT.json +++ b/lang/pt-PT.json @@ -68,6 +68,7 @@ "message.confirm-reset": "Tem a certeza que pretende restaurar as estatísticas de {target}?", "message.copied": "Copiado!", "message.delete-warning": "Todos os dados associados também serão eliminados.", + "message.edit-dashboard": "Edit dashboard", "message.failure": "Ocorreu um erro.", "message.get-share-url": "Obter link de partilha", "message.get-tracking-code": "Obter código de rastreamento", diff --git a/lang/ro-RO.json b/lang/ro-RO.json index 6d8bc2d0..7d2179b9 100644 --- a/lang/ro-RO.json +++ b/lang/ro-RO.json @@ -68,6 +68,7 @@ "message.confirm-reset": "Sunteți sigur că doriți să resetați statisticile pentru {target}?", "message.copied": "Copiat!", "message.delete-warning": "Toate datele asociate vor fi șterse, de asemenea.", + "message.edit-dashboard": "Edit dashboard", "message.failure": "Ceva n-a mers bine.", "message.get-share-url": "Obține adresa URL de partajare", "message.get-tracking-code": "Obține codul de urmărire", diff --git a/lang/ru-RU.json b/lang/ru-RU.json index 4d04c41b..80d53783 100644 --- a/lang/ru-RU.json +++ b/lang/ru-RU.json @@ -68,6 +68,7 @@ "message.confirm-reset": "Вы уверены, что хотите сбросить статистику {target}?", "message.copied": "Скопировано!", "message.delete-warning": "Все связанные данные будут также удалены.", + "message.edit-dashboard": "Edit dashboard", "message.failure": "Что-то пошло не так.", "message.get-share-url": "Получить публичную ссылку", "message.get-tracking-code": "Получить код отслеживания", diff --git a/lang/sk-SK.json b/lang/sk-SK.json index 7bc56b3c..8a49a3fb 100644 --- a/lang/sk-SK.json +++ b/lang/sk-SK.json @@ -68,6 +68,7 @@ "message.confirm-reset": "Are your sure you want to reset {target}'s statistics?", "message.copied": "Skopírované!", "message.delete-warning": "Všetky príbuzné data budu tiež zmazané.", + "message.edit-dashboard": "Edit dashboard", "message.failure": "Niečo sa pokazilo.", "message.get-share-url": "Získať zdielané URL", "message.get-tracking-code": "Získať tracking kód", diff --git a/lang/sl-SI.json b/lang/sl-SI.json index 2c94a9fb..a6b3d487 100644 --- a/lang/sl-SI.json +++ b/lang/sl-SI.json @@ -68,6 +68,7 @@ "message.confirm-reset": "Are your sure you want to reset {target}'s statistics?", "message.copied": "Kopirano!", "message.delete-warning": "Izbrisani bodo tudi vsi povezani podatki.", + "message.edit-dashboard": "Edit dashboard", "message.failure": "Prišlo je do napake.", "message.get-share-url": "Pridobi URL za skupno rabo", "message.get-tracking-code": "Pridobi kodo za sledenje", diff --git a/lang/sv-SE.json b/lang/sv-SE.json index 2a0e4123..64e4b02d 100644 --- a/lang/sv-SE.json +++ b/lang/sv-SE.json @@ -68,6 +68,7 @@ "message.confirm-reset": "Är du säker på att du vill återställa statistiken för {target}?", "message.copied": "Kopierad!", "message.delete-warning": "All tillhörande data kommer också raderas.", + "message.edit-dashboard": "Edit dashboard", "message.failure": "Något gick fel.", "message.get-share-url": "Visa delnings-URL", "message.get-tracking-code": "Visa spårningskod", diff --git a/lang/ta-IN.json b/lang/ta-IN.json index bebe7811..5b5606a3 100644 --- a/lang/ta-IN.json +++ b/lang/ta-IN.json @@ -68,6 +68,7 @@ "message.confirm-reset": "Are your sure you want to reset {target}'s statistics?", "message.copied": "நகலெடுக்கப்பட்டது!", "message.delete-warning": "தொடர்புடைய எல்லா தரவும் நீக்கப்படும்.", + "message.edit-dashboard": "Edit dashboard", "message.failure": "ஏதோ தவறு நடந்துவிட்டது.", "message.get-share-url": "கள முகவரியை ஐப் பெறுக", "message.get-tracking-code": "கண்காணிப்பு குறியீட்டைப் பெறுக", diff --git a/lang/th-TH.json b/lang/th-TH.json index 2f9999d8..e4c1ed4b 100644 --- a/lang/th-TH.json +++ b/lang/th-TH.json @@ -68,6 +68,7 @@ "message.confirm-reset": "คุณแน่ใจหรือไม่ว่าต้องการรีเซตข้อมูลสถิติของ {target} ?", "message.copied": "คัดลอกแล้ว!", "message.delete-warning": "ข้อมูลที่เกี่ยวข้องทั้งหมดจะถูกลบ.", + "message.edit-dashboard": "Edit dashboard", "message.failure": "เกิดข้อผิดพลาด.", "message.get-share-url": "รับลิงก์สำหรับแชร์", "message.get-tracking-code": "รับโค้ดสำหรับใช้ติดตาม", diff --git a/lang/tr-TR.json b/lang/tr-TR.json index 78098149..d630cb0b 100644 --- a/lang/tr-TR.json +++ b/lang/tr-TR.json @@ -68,6 +68,7 @@ "message.confirm-reset": "Are your sure you want to reset {target}'s statistics?", "message.copied": "Panoya kopyalandı!", "message.delete-warning": "İlişkili tüm veriler de silinecektir.", + "message.edit-dashboard": "Edit dashboard", "message.failure": "Bir şeyler ters gitti!", "message.get-share-url": "Paylaşım adresini al", "message.get-tracking-code": "İzleme kodunu al", diff --git a/lang/uk-UA.json b/lang/uk-UA.json index 20fe4112..7debaa97 100644 --- a/lang/uk-UA.json +++ b/lang/uk-UA.json @@ -68,6 +68,7 @@ "message.confirm-reset": "Ви впевнені, що бажаєте скинути статистику для {target}?", "message.copied": "Скопійовано!", "message.delete-warning": "Усі пов'язані дані будуть видалені також.", + "message.edit-dashboard": "Edit dashboard", "message.failure": "Щось пішло не так.", "message.get-share-url": "Отримати публічне посилання", "message.get-tracking-code": "Отримати код для відслідковування", diff --git a/lang/ur-PK.json b/lang/ur-PK.json index ff374da2..aadd3937 100644 --- a/lang/ur-PK.json +++ b/lang/ur-PK.json @@ -68,6 +68,7 @@ "message.confirm-reset": "کیا آپ واقعی {target} کے اعدادوشمار کو دوبارہ ترتیب دینا چاہتے ہیں؟", "message.copied": "کاپی کیا گیا!", "message.delete-warning": "تمام متعلقہ ڈیٹا بھی حذف کر دیا جائے گا۔", + "message.edit-dashboard": "Edit dashboard", "message.failure": "کچھ غلط ہو گیا.", "message.get-share-url": "شیئر URL حاصل کریں", "message.get-tracking-code": "ٹریکنگ کوڈ حاصل کریں", diff --git a/lang/vi-VN.json b/lang/vi-VN.json index 5e5fac33..2717bcc5 100644 --- a/lang/vi-VN.json +++ b/lang/vi-VN.json @@ -68,6 +68,7 @@ "message.confirm-reset": "Bạn có chắc chắn muốn tái thiết lập thống kê {target}?", "message.copied": "Đã sao chép!", "message.delete-warning": "Tất cả các dữ liệu liên quan cũng sẽ bị xoá.", + "message.edit-dashboard": "Edit dashboard", "message.failure": "Đã xảy ra lỗi.", "message.get-share-url": "Lấy URL chia sẻ", "message.get-tracking-code": "Lấy mã theo dõi", diff --git a/lang/zh-CN.json b/lang/zh-CN.json index a4c92224..5700c9e6 100644 --- a/lang/zh-CN.json +++ b/lang/zh-CN.json @@ -68,6 +68,7 @@ "message.confirm-reset": "您确定要重置 {target} 的数据吗?", "message.copied": "复制成功!", "message.delete-warning": "所有相关数据将会被删除。", + "message.edit-dashboard": "Edit dashboard", "message.failure": "出现错误。", "message.get-share-url": "获取共享链接", "message.get-tracking-code": "获取跟踪代码", diff --git a/lang/zh-TW.json b/lang/zh-TW.json index 5581ef0d..ed66f53f 100644 --- a/lang/zh-TW.json +++ b/lang/zh-TW.json @@ -68,6 +68,7 @@ "message.confirm-reset": "您確定要重置 {target} 的數據嗎?", "message.copied": "複製成功!", "message.delete-warning": "所有相關數據將會被刪除。", + "message.edit-dashboard": "Edit dashboard", "message.failure": "出現錯誤。", "message.get-share-url": "獲得分享連結", "message.get-tracking-code": "獲得追蹤代碼", diff --git a/lib/web.js b/lib/web.js index f51e3693..ea5513e3 100644 --- a/lib/web.js +++ b/lib/web.js @@ -61,10 +61,17 @@ export const setItem = (key, data, session) => { } }; -export const getItem = (key, session) => - typeof window !== 'undefined' - ? JSON.parse((session ? sessionStorage : localStorage).getItem(key) || null) - : null; +export const getItem = (key, session) => { + if (typeof window !== 'undefined') { + const value = (session ? sessionStorage : localStorage).getItem(key); + + if (value !== 'undefined') { + return JSON.parse(value); + } + } + + return null; +}; export const removeItem = (key, session) => { if (typeof window !== 'undefined') { diff --git a/public/intl/messages/ar-SA.json b/public/intl/messages/ar-SA.json index 089dacc0..81d1da96 100644 --- a/public/intl/messages/ar-SA.json +++ b/public/intl/messages/ar-SA.json @@ -477,6 +477,12 @@ "value": "كافة البيانات المرتبطة سيم حذفها ايضا." } ], + "message.edit-dashboard": [ + { + "type": 0, + "value": "Edit dashboard" + } + ], "message.failure": [ { "type": 0, diff --git a/public/intl/messages/bn-BD.json b/public/intl/messages/bn-BD.json index 8a91c167..846e60cd 100644 --- a/public/intl/messages/bn-BD.json +++ b/public/intl/messages/bn-BD.json @@ -477,6 +477,12 @@ "value": "সমস্ত সম্পর্কিত ডেটা পাশাপাশি মুছে ফেলা হবে।" } ], + "message.edit-dashboard": [ + { + "type": 0, + "value": "Edit dashboard" + } + ], "message.failure": [ { "type": 0, diff --git a/public/intl/messages/ca-ES.json b/public/intl/messages/ca-ES.json index 37bc240c..19bfab40 100644 --- a/public/intl/messages/ca-ES.json +++ b/public/intl/messages/ca-ES.json @@ -477,6 +477,12 @@ "value": "També s'esborraran totes les dades relacionades." } ], + "message.edit-dashboard": [ + { + "type": 0, + "value": "Edit dashboard" + } + ], "message.failure": [ { "type": 0, diff --git a/public/intl/messages/cs-CZ.json b/public/intl/messages/cs-CZ.json index c97984a2..f3bc624d 100644 --- a/public/intl/messages/cs-CZ.json +++ b/public/intl/messages/cs-CZ.json @@ -477,6 +477,12 @@ "value": "Všechna související data budou také smazána." } ], + "message.edit-dashboard": [ + { + "type": 0, + "value": "Edit dashboard" + } + ], "message.failure": [ { "type": 0, diff --git a/public/intl/messages/da-DK.json b/public/intl/messages/da-DK.json index cc15e71c..6fa6e176 100644 --- a/public/intl/messages/da-DK.json +++ b/public/intl/messages/da-DK.json @@ -477,6 +477,12 @@ "value": "Alle tilknyttede data slettes også." } ], + "message.edit-dashboard": [ + { + "type": 0, + "value": "Edit dashboard" + } + ], "message.failure": [ { "type": 0, diff --git a/public/intl/messages/de-DE.json b/public/intl/messages/de-DE.json index a64043ff..9ad2fe0c 100644 --- a/public/intl/messages/de-DE.json +++ b/public/intl/messages/de-DE.json @@ -477,6 +477,12 @@ "value": "Alle zugehörigen Daten werden ebenfalls gelöscht." } ], + "message.edit-dashboard": [ + { + "type": 0, + "value": "Edit dashboard" + } + ], "message.failure": [ { "type": 0, diff --git a/public/intl/messages/el-GR.json b/public/intl/messages/el-GR.json index 52a4554e..3e0a7040 100644 --- a/public/intl/messages/el-GR.json +++ b/public/intl/messages/el-GR.json @@ -477,6 +477,12 @@ "value": "Όλα τα σχετικά δεδομένα θα διαγραφούν επίσης." } ], + "message.edit-dashboard": [ + { + "type": 0, + "value": "Edit dashboard" + } + ], "message.failure": [ { "type": 0, diff --git a/public/intl/messages/en-GB.json b/public/intl/messages/en-GB.json index f3617455..590d5f46 100644 --- a/public/intl/messages/en-GB.json +++ b/public/intl/messages/en-GB.json @@ -477,6 +477,12 @@ "value": "All associated data will be deleted as well." } ], + "message.edit-dashboard": [ + { + "type": 0, + "value": "Edit dashboard" + } + ], "message.failure": [ { "type": 0, diff --git a/public/intl/messages/en-US.json b/public/intl/messages/en-US.json index f3617455..590d5f46 100644 --- a/public/intl/messages/en-US.json +++ b/public/intl/messages/en-US.json @@ -477,6 +477,12 @@ "value": "All associated data will be deleted as well." } ], + "message.edit-dashboard": [ + { + "type": 0, + "value": "Edit dashboard" + } + ], "message.failure": [ { "type": 0, diff --git a/public/intl/messages/es-MX.json b/public/intl/messages/es-MX.json index 2a90fb86..d31ba6cf 100644 --- a/public/intl/messages/es-MX.json +++ b/public/intl/messages/es-MX.json @@ -477,6 +477,12 @@ "value": "Toda la información relacionada será eliminada." } ], + "message.edit-dashboard": [ + { + "type": 0, + "value": "Edit dashboard" + } + ], "message.failure": [ { "type": 0, diff --git a/public/intl/messages/fa-IR.json b/public/intl/messages/fa-IR.json index 06f71286..b765275b 100644 --- a/public/intl/messages/fa-IR.json +++ b/public/intl/messages/fa-IR.json @@ -477,6 +477,12 @@ "value": "همه‌ی داده‌های مرتبط هم حذف خواهد شد." } ], + "message.edit-dashboard": [ + { + "type": 0, + "value": "Edit dashboard" + } + ], "message.failure": [ { "type": 0, diff --git a/public/intl/messages/fi-FI.json b/public/intl/messages/fi-FI.json index 1c274608..6293ad9a 100644 --- a/public/intl/messages/fi-FI.json +++ b/public/intl/messages/fi-FI.json @@ -477,6 +477,12 @@ "value": "Kaikki siihen liittyvät tiedot poistetaan." } ], + "message.edit-dashboard": [ + { + "type": 0, + "value": "Edit dashboard" + } + ], "message.failure": [ { "type": 0, diff --git a/public/intl/messages/fo-FO.json b/public/intl/messages/fo-FO.json index 47baddf8..02205bae 100644 --- a/public/intl/messages/fo-FO.json +++ b/public/intl/messages/fo-FO.json @@ -477,6 +477,12 @@ "value": "Øll data ið er knýtt at verður eisini strika." } ], + "message.edit-dashboard": [ + { + "type": 0, + "value": "Edit dashboard" + } + ], "message.failure": [ { "type": 0, diff --git a/public/intl/messages/fr-FR.json b/public/intl/messages/fr-FR.json index db07da60..ddec676a 100644 --- a/public/intl/messages/fr-FR.json +++ b/public/intl/messages/fr-FR.json @@ -473,6 +473,12 @@ "value": "Toutes les données associées seront également supprimées." } ], + "message.edit-dashboard": [ + { + "type": 0, + "value": "Edit dashboard" + } + ], "message.failure": [ { "type": 0, diff --git a/public/intl/messages/ga-ES.json b/public/intl/messages/ga-ES.json index a65f5c6c..af959205 100644 --- a/public/intl/messages/ga-ES.json +++ b/public/intl/messages/ga-ES.json @@ -477,6 +477,12 @@ "value": "Tamén serán borrados tódolos datos asociados." } ], + "message.edit-dashboard": [ + { + "type": 0, + "value": "Edit dashboard" + } + ], "message.failure": [ { "type": 0, diff --git a/public/intl/messages/he-IL.json b/public/intl/messages/he-IL.json index ff39fe5f..d6dd900f 100644 --- a/public/intl/messages/he-IL.json +++ b/public/intl/messages/he-IL.json @@ -469,6 +469,12 @@ "value": "כל המידע המקושר יימחק" } ], + "message.edit-dashboard": [ + { + "type": 0, + "value": "Edit dashboard" + } + ], "message.failure": [ { "type": 0, diff --git a/public/intl/messages/hi-IN.json b/public/intl/messages/hi-IN.json index 763c492a..ff76fdb9 100644 --- a/public/intl/messages/hi-IN.json +++ b/public/intl/messages/hi-IN.json @@ -477,6 +477,12 @@ "value": "सभी संबद्ध डेटा को भी हटा दिया जाएगा।" } ], + "message.edit-dashboard": [ + { + "type": 0, + "value": "Edit dashboard" + } + ], "message.failure": [ { "type": 0, diff --git a/public/intl/messages/hu-HU.json b/public/intl/messages/hu-HU.json index d659f447..238a6301 100644 --- a/public/intl/messages/hu-HU.json +++ b/public/intl/messages/hu-HU.json @@ -481,6 +481,12 @@ "value": "Minden társított adat törlésre kerül." } ], + "message.edit-dashboard": [ + { + "type": 0, + "value": "Edit dashboard" + } + ], "message.failure": [ { "type": 0, diff --git a/public/intl/messages/id-ID.json b/public/intl/messages/id-ID.json index 3d9d9285..cc049e2c 100644 --- a/public/intl/messages/id-ID.json +++ b/public/intl/messages/id-ID.json @@ -445,6 +445,12 @@ "value": "Semua data terkait juga akan dihapus." } ], + "message.edit-dashboard": [ + { + "type": 0, + "value": "Edit dashboard" + } + ], "message.failure": [ { "type": 0, diff --git a/public/intl/messages/it-IT.json b/public/intl/messages/it-IT.json index ae2b2ec6..419ca42e 100644 --- a/public/intl/messages/it-IT.json +++ b/public/intl/messages/it-IT.json @@ -481,6 +481,12 @@ "value": "Saranno eliminati anche tutti i dati associati." } ], + "message.edit-dashboard": [ + { + "type": 0, + "value": "Edit dashboard" + } + ], "message.failure": [ { "type": 0, diff --git a/public/intl/messages/ja-JP.json b/public/intl/messages/ja-JP.json index b864fdf8..0c52a737 100644 --- a/public/intl/messages/ja-JP.json +++ b/public/intl/messages/ja-JP.json @@ -449,6 +449,12 @@ "value": "関連するすべてのデータも削除されます。" } ], + "message.edit-dashboard": [ + { + "type": 0, + "value": "Edit dashboard" + } + ], "message.failure": [ { "type": 0, diff --git a/public/intl/messages/ko-KR.json b/public/intl/messages/ko-KR.json index 43bb7de9..54c9d591 100644 --- a/public/intl/messages/ko-KR.json +++ b/public/intl/messages/ko-KR.json @@ -449,6 +449,12 @@ "value": "관련된 모든 데이터도 삭제됩니다." } ], + "message.edit-dashboard": [ + { + "type": 0, + "value": "Edit dashboard" + } + ], "message.failure": [ { "type": 0, diff --git a/public/intl/messages/lt-LT.json b/public/intl/messages/lt-LT.json index 1946947d..d9459fbc 100644 --- a/public/intl/messages/lt-LT.json +++ b/public/intl/messages/lt-LT.json @@ -602,6 +602,12 @@ "value": "Visi susiję duomenys taip pat bus ištrinti." } ], + "message.edit-dashboard": [ + { + "type": 0, + "value": "Edit dashboard" + } + ], "message.failure": [ { "type": 0, diff --git a/public/intl/messages/mn-MN.json b/public/intl/messages/mn-MN.json index 3e39f2bc..c3bf5467 100644 --- a/public/intl/messages/mn-MN.json +++ b/public/intl/messages/mn-MN.json @@ -485,6 +485,12 @@ "value": "Үүнтэй холбоотой бүх өгөгдөл устах болно." } ], + "message.edit-dashboard": [ + { + "type": 0, + "value": "Edit dashboard" + } + ], "message.failure": [ { "type": 0, diff --git a/public/intl/messages/ms-MY.json b/public/intl/messages/ms-MY.json index 39ca49e3..d025341e 100644 --- a/public/intl/messages/ms-MY.json +++ b/public/intl/messages/ms-MY.json @@ -469,6 +469,12 @@ "value": "Semua data yang berkaitan juga akan dihapuskan." } ], + "message.edit-dashboard": [ + { + "type": 0, + "value": "Edit dashboard" + } + ], "message.failure": [ { "type": 0, diff --git a/public/intl/messages/nb-NO.json b/public/intl/messages/nb-NO.json index b0209416..dc0512ef 100644 --- a/public/intl/messages/nb-NO.json +++ b/public/intl/messages/nb-NO.json @@ -481,6 +481,12 @@ "value": "Alle tilknyttede data slettes også." } ], + "message.edit-dashboard": [ + { + "type": 0, + "value": "Edit dashboard" + } + ], "message.failure": [ { "type": 0, diff --git a/public/intl/messages/nl-NL.json b/public/intl/messages/nl-NL.json index ea391a0e..8e88fe86 100644 --- a/public/intl/messages/nl-NL.json +++ b/public/intl/messages/nl-NL.json @@ -477,6 +477,12 @@ "value": "Alle verwante gegezens zullen ook verwijderd worden." } ], + "message.edit-dashboard": [ + { + "type": 0, + "value": "Edit dashboard" + } + ], "message.failure": [ { "type": 0, diff --git a/public/intl/messages/pl-PL.json b/public/intl/messages/pl-PL.json index b954aa99..43702359 100644 --- a/public/intl/messages/pl-PL.json +++ b/public/intl/messages/pl-PL.json @@ -477,6 +477,12 @@ "value": "Wszystkie powiązane dane również zostaną usunięte." } ], + "message.edit-dashboard": [ + { + "type": 0, + "value": "Edit dashboard" + } + ], "message.failure": [ { "type": 0, diff --git a/public/intl/messages/pt-BR.json b/public/intl/messages/pt-BR.json index b9d058a7..db16460c 100644 --- a/public/intl/messages/pt-BR.json +++ b/public/intl/messages/pt-BR.json @@ -481,6 +481,12 @@ "value": "Todos os dados associados também serão eliminados." } ], + "message.edit-dashboard": [ + { + "type": 0, + "value": "Edit dashboard" + } + ], "message.failure": [ { "type": 0, diff --git a/public/intl/messages/pt-PT.json b/public/intl/messages/pt-PT.json index 1ca21788..ec2b480f 100644 --- a/public/intl/messages/pt-PT.json +++ b/public/intl/messages/pt-PT.json @@ -481,6 +481,12 @@ "value": "Todos os dados associados também serão eliminados." } ], + "message.edit-dashboard": [ + { + "type": 0, + "value": "Edit dashboard" + } + ], "message.failure": [ { "type": 0, diff --git a/public/intl/messages/ro-RO.json b/public/intl/messages/ro-RO.json index 2d74e5e2..544a173e 100644 --- a/public/intl/messages/ro-RO.json +++ b/public/intl/messages/ro-RO.json @@ -477,6 +477,12 @@ "value": "Toate datele asociate vor fi șterse, de asemenea." } ], + "message.edit-dashboard": [ + { + "type": 0, + "value": "Edit dashboard" + } + ], "message.failure": [ { "type": 0, diff --git a/public/intl/messages/ru-RU.json b/public/intl/messages/ru-RU.json index 52400370..a5bbdd66 100644 --- a/public/intl/messages/ru-RU.json +++ b/public/intl/messages/ru-RU.json @@ -453,6 +453,12 @@ "value": "Все связанные данные будут также удалены." } ], + "message.edit-dashboard": [ + { + "type": 0, + "value": "Edit dashboard" + } + ], "message.failure": [ { "type": 0, diff --git a/public/intl/messages/sk-SK.json b/public/intl/messages/sk-SK.json index a7e36657..8bdc3928 100644 --- a/public/intl/messages/sk-SK.json +++ b/public/intl/messages/sk-SK.json @@ -477,6 +477,12 @@ "value": "Všetky príbuzné data budu tiež zmazané." } ], + "message.edit-dashboard": [ + { + "type": 0, + "value": "Edit dashboard" + } + ], "message.failure": [ { "type": 0, diff --git a/public/intl/messages/sl-SI.json b/public/intl/messages/sl-SI.json index b7d478ed..103baa02 100644 --- a/public/intl/messages/sl-SI.json +++ b/public/intl/messages/sl-SI.json @@ -477,6 +477,12 @@ "value": "Izbrisani bodo tudi vsi povezani podatki." } ], + "message.edit-dashboard": [ + { + "type": 0, + "value": "Edit dashboard" + } + ], "message.failure": [ { "type": 0, diff --git a/public/intl/messages/sv-SE.json b/public/intl/messages/sv-SE.json index 21df2569..055d4700 100644 --- a/public/intl/messages/sv-SE.json +++ b/public/intl/messages/sv-SE.json @@ -481,6 +481,12 @@ "value": "All tillhörande data kommer också raderas." } ], + "message.edit-dashboard": [ + { + "type": 0, + "value": "Edit dashboard" + } + ], "message.failure": [ { "type": 0, diff --git a/public/intl/messages/ta-IN.json b/public/intl/messages/ta-IN.json index d5a8e5d8..4c013afb 100644 --- a/public/intl/messages/ta-IN.json +++ b/public/intl/messages/ta-IN.json @@ -477,6 +477,12 @@ "value": "தொடர்புடைய எல்லா தரவும் நீக்கப்படும்." } ], + "message.edit-dashboard": [ + { + "type": 0, + "value": "Edit dashboard" + } + ], "message.failure": [ { "type": 0, diff --git a/public/intl/messages/th-TH.json b/public/intl/messages/th-TH.json index 5240adbe..aec1499e 100644 --- a/public/intl/messages/th-TH.json +++ b/public/intl/messages/th-TH.json @@ -473,6 +473,12 @@ "value": "ข้อมูลที่เกี่ยวข้องทั้งหมดจะถูกลบ." } ], + "message.edit-dashboard": [ + { + "type": 0, + "value": "Edit dashboard" + } + ], "message.failure": [ { "type": 0, diff --git a/public/intl/messages/tr-TR.json b/public/intl/messages/tr-TR.json index 8225c225..a21af75d 100644 --- a/public/intl/messages/tr-TR.json +++ b/public/intl/messages/tr-TR.json @@ -449,6 +449,12 @@ "value": "İlişkili tüm veriler de silinecektir." } ], + "message.edit-dashboard": [ + { + "type": 0, + "value": "Edit dashboard" + } + ], "message.failure": [ { "type": 0, diff --git a/public/intl/messages/uk-UA.json b/public/intl/messages/uk-UA.json index b513fb68..a2765209 100644 --- a/public/intl/messages/uk-UA.json +++ b/public/intl/messages/uk-UA.json @@ -453,6 +453,12 @@ "value": "Усі пов'язані дані будуть видалені також." } ], + "message.edit-dashboard": [ + { + "type": 0, + "value": "Edit dashboard" + } + ], "message.failure": [ { "type": 0, diff --git a/public/intl/messages/ur-PK.json b/public/intl/messages/ur-PK.json index 52a0d532..c09106e5 100644 --- a/public/intl/messages/ur-PK.json +++ b/public/intl/messages/ur-PK.json @@ -481,6 +481,12 @@ "value": "تمام متعلقہ ڈیٹا بھی حذف کر دیا جائے گا۔" } ], + "message.edit-dashboard": [ + { + "type": 0, + "value": "Edit dashboard" + } + ], "message.failure": [ { "type": 0, diff --git a/public/intl/messages/vi-VN.json b/public/intl/messages/vi-VN.json index 8c87d639..b4dc3da0 100644 --- a/public/intl/messages/vi-VN.json +++ b/public/intl/messages/vi-VN.json @@ -469,6 +469,12 @@ "value": "Tất cả các dữ liệu liên quan cũng sẽ bị xoá." } ], + "message.edit-dashboard": [ + { + "type": 0, + "value": "Edit dashboard" + } + ], "message.failure": [ { "type": 0, diff --git a/public/intl/messages/zh-CN.json b/public/intl/messages/zh-CN.json index fc79e2c0..67826fea 100644 --- a/public/intl/messages/zh-CN.json +++ b/public/intl/messages/zh-CN.json @@ -457,6 +457,12 @@ "value": "所有相关数据将会被删除。" } ], + "message.edit-dashboard": [ + { + "type": 0, + "value": "Edit dashboard" + } + ], "message.failure": [ { "type": 0, diff --git a/public/intl/messages/zh-TW.json b/public/intl/messages/zh-TW.json index dc78dfc3..5c78a29d 100644 --- a/public/intl/messages/zh-TW.json +++ b/public/intl/messages/zh-TW.json @@ -457,6 +457,12 @@ "value": "所有相關數據將會被刪除。" } ], + "message.edit-dashboard": [ + { + "type": 0, + "value": "Edit dashboard" + } + ], "message.failure": [ { "type": 0, diff --git a/store/app.js b/store/app.js index c2964a34..dc5f527d 100644 --- a/store/app.js +++ b/store/app.js @@ -1,25 +1,10 @@ import create from 'zustand'; -import { - DASHBOARD_CONFIG, - DEFAULT_LOCALE, - DEFAULT_THEME, - LOCALE_CONFIG, - THEME_CONFIG, - DEFAULT_WEBSITE_LIMIT, -} from 'lib/constants'; -import { getItem, setItem } from 'lib/web'; - -export const defaultDashboardConfig = { - showCharts: true, - limit: DEFAULT_WEBSITE_LIMIT, - websiteOrdering: {}, - changeOrderMode: false, -}; +import { DEFAULT_LOCALE, DEFAULT_THEME, LOCALE_CONFIG, THEME_CONFIG } from 'lib/constants'; +import { getItem } from 'lib/web'; const initialState = { locale: getItem(LOCALE_CONFIG) || DEFAULT_LOCALE, theme: getItem(THEME_CONFIG) || DEFAULT_THEME, - dashboard: getItem(DASHBOARD_CONFIG) || defaultDashboardConfig, shareToken: null, user: null, config: null, @@ -43,11 +28,6 @@ export function setUser(user) { store.setState({ user }); } -export function setDashboard(dashboard) { - store.setState({ dashboard }); - setItem(DASHBOARD_CONFIG, dashboard); -} - export function setConfig(config) { store.setState({ config }); } diff --git a/store/dashboard.js b/store/dashboard.js new file mode 100644 index 00000000..54d526d0 --- /dev/null +++ b/store/dashboard.js @@ -0,0 +1,21 @@ +import create from 'zustand'; +import { DASHBOARD_CONFIG, DEFAULT_WEBSITE_LIMIT } from 'lib/constants'; +import { getItem, setItem } from 'lib/web'; + +export const initialState = { + showCharts: true, + limit: DEFAULT_WEBSITE_LIMIT, + websiteOrder: {}, + editing: false, +}; + +const store = create(() => ({ ...initialState, ...getItem(DASHBOARD_CONFIG) })); + +export function saveDashboard(settings) { + const state = typeof settings === 'function' ? settings(store.getState()) : settings; + store.setState(state); + + setItem(DASHBOARD_CONFIG, store.getState()); +} + +export default store;