Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

Add personal dashboard flow and per-component website selection

Mike Cao631cc46f7f48
diff --git a/next.config.ts b/next.config.ts
index 024024388..070eba635 100644
--- a/next.config.ts
+++ b/next.config.ts
@@ -116,6 +116,16 @@ if (collectApiEndpoint) {
}
const redirects = [
+ {
+ source: '/teams/:id/dashboard/edit',
+ destination: '/dashboard/edit',
+ permanent: false,
+ },
+ {
+ source: '/teams/:id/dashboard',
+ destination: '/dashboard',
+ permanent: false,
+ },
{
source: '/settings',
destination: '/settings/preferences',
diff --git a/public/intl/messages/ar-SA.json b/public/intl/messages/ar-SA.json
index 09343a814..4f0e7897a 100644
--- a/public/intl/messages/ar-SA.json
+++ b/public/intl/messages/ar-SA.json
@@ -98,7 +98,6 @@
"download": "تحميل",
"dropoff": "إنزال",
"edit": "تعديل",
- "edit-dashboard": "عدّل لوحة التحكم",
"edit-member": "عدّل العضو",
"email": "بريد إلكتروني",
"enable-share-url": "فعّل مشاركة الرابط",
diff --git a/public/intl/messages/be-BY.json b/public/intl/messages/be-BY.json
index 66a4720e3..a2ef2a37c 100644
--- a/public/intl/messages/be-BY.json
+++ b/public/intl/messages/be-BY.json
@@ -98,7 +98,6 @@
"download": "Спампаваць",
"dropoff": "Адмовы",
"edit": "Змяніць",
- "edit-dashboard": "Змяніць інфармацыйную панэль",
"edit-member": "Рэдагаваць удзельніка",
"email": "Электронная пошта",
"enable-share-url": "Дазволіць дзяліцца спасылкай",
diff --git a/public/intl/messages/bg-BG.json b/public/intl/messages/bg-BG.json
index 634ead871..e3d7cff87 100644
--- a/public/intl/messages/bg-BG.json
+++ b/public/intl/messages/bg-BG.json
@@ -98,7 +98,6 @@
"download": "Изтегляне",
"dropoff": "Отпадане",
"edit": "Редактирай",
- "edit-dashboard": "Редактирай табло",
"edit-member": "Редактирай член",
"email": "Имейл",
"enable-share-url": "Активирай Линк за споделяне",
diff --git a/public/intl/messages/bn-BD.json b/public/intl/messages/bn-BD.json
index 2c1545543..03a79d301 100644
--- a/public/intl/messages/bn-BD.json
+++ b/public/intl/messages/bn-BD.json
@@ -98,7 +98,6 @@
"download": "ডাউনলোড",
"dropoff": "ছেড়ে যাওয়া",
"edit": "সম্পাদনা করুন",
- "edit-dashboard": "ড্যাশবোর্ড সম্পাদনা করুন",
"edit-member": "সদস্য সম্পাদনা করুন",
"email": "ইমেইল",
"enable-share-url": "শেয়ার ইউআরএল শেয়ার করুন",
diff --git a/public/intl/messages/bs-BA.json b/public/intl/messages/bs-BA.json
index a277b8483..1fc18f431 100644
--- a/public/intl/messages/bs-BA.json
+++ b/public/intl/messages/bs-BA.json
@@ -98,7 +98,6 @@
"download": "Preuzmi",
"dropoff": "Odlazak",
"edit": "Uredi",
- "edit-dashboard": "Uredi dashboard",
"edit-member": "Uredi člana",
"email": "E-mail",
"enable-share-url": "Omogući URL za dijeljenje",
diff --git a/public/intl/messages/ca-ES.json b/public/intl/messages/ca-ES.json
index 367f51a50..0a6984c1a 100644
--- a/public/intl/messages/ca-ES.json
+++ b/public/intl/messages/ca-ES.json
@@ -98,7 +98,6 @@
"download": "Descarregar",
"dropoff": "Abandonament",
"edit": "Edita",
- "edit-dashboard": "Edita panell",
"edit-member": "Edita membre",
"email": "Correu electrònic",
"enable-share-url": "Activa l'enllaç per compartir",
diff --git a/public/intl/messages/cs-CZ.json b/public/intl/messages/cs-CZ.json
index 966f37a8a..43903a152 100644
--- a/public/intl/messages/cs-CZ.json
+++ b/public/intl/messages/cs-CZ.json
@@ -98,7 +98,6 @@
"download": "Stáhnout",
"dropoff": "Opuštění",
"edit": "Upravit",
- "edit-dashboard": "Upravit dashboard",
"edit-member": "Upravit člena",
"email": "E-mail",
"enable-share-url": "Povolit sdílení URL",
diff --git a/public/intl/messages/da-DK.json b/public/intl/messages/da-DK.json
index 7c753875e..0c3d1006c 100644
--- a/public/intl/messages/da-DK.json
+++ b/public/intl/messages/da-DK.json
@@ -98,7 +98,6 @@
"download": "Download",
"dropoff": "Frafald",
"edit": "Rediger",
- "edit-dashboard": "Rediger betjeningspanel",
"edit-member": "Rediger medlem",
"email": "E-mail",
"enable-share-url": "Aktivér delings-URL",
diff --git a/public/intl/messages/de-CH.json b/public/intl/messages/de-CH.json
index f916ff428..6b3b4af59 100644
--- a/public/intl/messages/de-CH.json
+++ b/public/intl/messages/de-CH.json
@@ -98,7 +98,6 @@
"download": "Herunterladen",
"dropoff": "Absprung",
"edit": "Bearbeite",
- "edit-dashboard": "Dashboard bearbeite",
"edit-member": "Mitglied bearbeite",
"email": "E-Mail",
"enable-share-url": "Freigab-URL aktiviere",
diff --git a/public/intl/messages/de-DE.json b/public/intl/messages/de-DE.json
index 4628487e0..0b313fdf3 100644
--- a/public/intl/messages/de-DE.json
+++ b/public/intl/messages/de-DE.json
@@ -98,7 +98,6 @@
"download": "Herunterladen",
"dropoff": "Absprung",
"edit": "Bearbeiten",
- "edit-dashboard": "Dashboard bearbeiten",
"edit-member": "Mitglied bearbeiten",
"email": "E-Mail",
"enable-share-url": "Freigabe-URL aktivieren",
diff --git a/public/intl/messages/el-GR.json b/public/intl/messages/el-GR.json
index 62f8ac77c..597bbdded 100644
--- a/public/intl/messages/el-GR.json
+++ b/public/intl/messages/el-GR.json
@@ -98,7 +98,6 @@
"download": "Λήψη",
"dropoff": "Εγκατάλειψη",
"edit": "Επεξεργασία",
- "edit-dashboard": "Επεξεργασία πίνακα ελέγχου",
"edit-member": "Επεξεργασία μέλους",
"email": "Email",
"enable-share-url": "Ενεργοποίηση κοινής χρήσης URL",
diff --git a/public/intl/messages/en-GB.json b/public/intl/messages/en-GB.json
index b2338d756..741b5c8c3 100644
--- a/public/intl/messages/en-GB.json
+++ b/public/intl/messages/en-GB.json
@@ -98,7 +98,6 @@
"download": "Download",
"dropoff": "Dropoff",
"edit": "Edit",
- "edit-dashboard": "Edit dashboard",
"edit-member": "Edit member",
"email": "Email",
"enable-share-url": "Enable share URL",
diff --git a/public/intl/messages/en-US.json b/public/intl/messages/en-US.json
index 3fdffef66..67721ef04 100644
--- a/public/intl/messages/en-US.json
+++ b/public/intl/messages/en-US.json
@@ -98,7 +98,6 @@
"download": "Download",
"dropoff": "Dropoff",
"edit": "Edit",
- "edit-dashboard": "Edit dashboard",
"edit-member": "Edit member",
"email": "Email",
"enable-share-url": "Enable share URL",
@@ -351,6 +350,7 @@
"delete-team-warning": "Deleting a team will also delete all team websites.",
"delete-website-warning": "All website data will be deleted.",
"error": "Something went wrong.",
+ "empty-dashboard": "Your dashboard is empty. Click Edit to add your first component.",
"event-log": "<b>{event}</b> on <a>{url}</a>",
"forbidden": "Forbidden",
"go-to-settings": "Go to settings",
diff --git a/public/intl/messages/es-ES.json b/public/intl/messages/es-ES.json
index ca06e4ae8..41a3fecfc 100644
--- a/public/intl/messages/es-ES.json
+++ b/public/intl/messages/es-ES.json
@@ -98,7 +98,6 @@
"download": "Descargar",
"dropoff": "Abandono",
"edit": "Editar",
- "edit-dashboard": "Editar panel",
"edit-member": "Editar miembro",
"email": "Correo electrónico",
"enable-share-url": "Habilitar compartir URL",
diff --git a/public/intl/messages/fa-IR.json b/public/intl/messages/fa-IR.json
index 22d6de276..17be3d950 100644
--- a/public/intl/messages/fa-IR.json
+++ b/public/intl/messages/fa-IR.json
@@ -98,7 +98,6 @@
"download": "دانلود",
"dropoff": "رها کردن",
"edit": "ویرایش",
- "edit-dashboard": "ویرایش داشبورد",
"edit-member": "ویرایش عضو",
"email": "ایمیل",
"enable-share-url": "فعال کردن اشتراک گذاری آدرس اینترنتی",
diff --git a/public/intl/messages/fi-FI.json b/public/intl/messages/fi-FI.json
index cd4d9180a..4d86d3cc7 100644
--- a/public/intl/messages/fi-FI.json
+++ b/public/intl/messages/fi-FI.json
@@ -98,7 +98,6 @@
"download": "Lataa",
"dropoff": "Poistuminen",
"edit": "Muokkaa",
- "edit-dashboard": "Muokkaa ohjauspaneelia",
"edit-member": "Muokkaa jäsentä",
"email": "Sähköposti",
"enable-share-url": "Ota jakamisen URL-osoite käyttöön",
diff --git a/public/intl/messages/fo-FO.json b/public/intl/messages/fo-FO.json
index 274cc4355..45674c294 100644
--- a/public/intl/messages/fo-FO.json
+++ b/public/intl/messages/fo-FO.json
@@ -98,7 +98,6 @@
"download": "Tak niður",
"dropoff": "Fráfall",
"edit": "Ger broyting",
- "edit-dashboard": "Ritstjórna yvirlitsskíggja",
"edit-member": "Ritstjórna lim",
"email": "Teldupostur",
"enable-share-url": "Virkja deili leinki",
diff --git a/public/intl/messages/fr-FR.json b/public/intl/messages/fr-FR.json
index ebe1265fe..11ca722ff 100644
--- a/public/intl/messages/fr-FR.json
+++ b/public/intl/messages/fr-FR.json
@@ -98,7 +98,6 @@
"download": "Télécharger",
"dropoff": "Abandons",
"edit": "Modifier",
- "edit-dashboard": "Modifier le tableau de bord",
"edit-member": "Modifier le membre",
"email": "E-mail",
"enable-share-url": "Activer l'URL de partage",
diff --git a/public/intl/messages/ga-ES.json b/public/intl/messages/ga-ES.json
index 6ac11f20b..34a818a1e 100644
--- a/public/intl/messages/ga-ES.json
+++ b/public/intl/messages/ga-ES.json
@@ -98,7 +98,6 @@
"download": "Descargar",
"dropoff": "Disminución",
"edit": "Editar",
- "edit-dashboard": "Editar taboleiro",
"edit-member": "Editar membro",
"email": "Correo electrónico",
"enable-share-url": "Activar URL de compartición",
diff --git a/public/intl/messages/he-IL.json b/public/intl/messages/he-IL.json
index 8641c44f2..200412414 100644
--- a/public/intl/messages/he-IL.json
+++ b/public/intl/messages/he-IL.json
@@ -98,7 +98,6 @@
"download": "הורדה",
"dropoff": "עזיבה",
"edit": "עריכה",
- "edit-dashboard": "ערוך לוח מחוונים",
"edit-member": "ערוך חבר",
"email": "אימייל",
"enable-share-url": "הפעלת URL שיתוף",
diff --git a/public/intl/messages/hi-IN.json b/public/intl/messages/hi-IN.json
index 5864c1d25..06ecbf636 100644
--- a/public/intl/messages/hi-IN.json
+++ b/public/intl/messages/hi-IN.json
@@ -98,7 +98,6 @@
"download": "डाउनलोड",
"dropoff": "ड्रॉपऑफ",
"edit": "संपादित करें",
- "edit-dashboard": "डैशबोर्ड संपादित करें",
"edit-member": "सदस्य संपादित करें",
"email": "ईमेल",
"enable-share-url": "शेयर URL सक्षम करें",
diff --git a/public/intl/messages/hr-HR.json b/public/intl/messages/hr-HR.json
index 12412d9ee..f048dfda0 100644
--- a/public/intl/messages/hr-HR.json
+++ b/public/intl/messages/hr-HR.json
@@ -98,7 +98,6 @@
"download": "Preuzmi",
"dropoff": "Odlazak",
"edit": "Uredi",
- "edit-dashboard": "Uredi nadzornu ploču",
"edit-member": "Uredi člana",
"email": "E-mail",
"enable-share-url": "Omogući dijeljenje poveznice",
diff --git a/public/intl/messages/hu-HU.json b/public/intl/messages/hu-HU.json
index 3c51c328a..6673ec421 100644
--- a/public/intl/messages/hu-HU.json
+++ b/public/intl/messages/hu-HU.json
@@ -98,7 +98,6 @@
"download": "Letöltés",
"dropoff": "Lemorzsolódás",
"edit": "Módosítás",
- "edit-dashboard": "Irányítópult szerkesztése",
"edit-member": "Tag szerkesztése",
"email": "E-mail",
"enable-share-url": "URL-megosztás engedélyezése",
diff --git a/public/intl/messages/id-ID.json b/public/intl/messages/id-ID.json
index 9c8640aa8..f0cb7e003 100644
--- a/public/intl/messages/id-ID.json
+++ b/public/intl/messages/id-ID.json
@@ -98,7 +98,6 @@
"download": "Unduh",
"dropoff": "Penurunan",
"edit": "Sunting",
- "edit-dashboard": "Sunting dasbor",
"edit-member": "Sunting anggota",
"email": "Email",
"enable-share-url": "Aktifkan URL berbagi",
diff --git a/public/intl/messages/it-IT.json b/public/intl/messages/it-IT.json
index 5fe81e271..fc403768e 100644
--- a/public/intl/messages/it-IT.json
+++ b/public/intl/messages/it-IT.json
@@ -98,7 +98,6 @@
"download": "Scarica",
"dropoff": "Abbandono",
"edit": "Modifica",
- "edit-dashboard": "Modifica pannello di controllo",
"edit-member": "Modifica membro",
"email": "Email",
"enable-share-url": "Abilita URL di condivisione",
diff --git a/public/intl/messages/ja-JP.json b/public/intl/messages/ja-JP.json
index f8ed9f540..900bb0f6c 100644
--- a/public/intl/messages/ja-JP.json
+++ b/public/intl/messages/ja-JP.json
@@ -98,7 +98,6 @@
"download": "ダウンロード",
"dropoff": "切り捨て",
"edit": "編集",
- "edit-dashboard": "ダッシュボードの編集",
"edit-member": "メンバーの編集",
"email": "メール",
"enable-share-url": "共有URLを有効にする",
diff --git a/public/intl/messages/km-KH.json b/public/intl/messages/km-KH.json
index db50d49a4..defab4f86 100644
--- a/public/intl/messages/km-KH.json
+++ b/public/intl/messages/km-KH.json
@@ -98,7 +98,6 @@
"download": "ទាញយក",
"dropoff": "ការចាកចេញ",
"edit": "កែប្រែ",
- "edit-dashboard": "កែផ្ទាំងគ្រប់គ្រង",
"edit-member": "កែព័ត៌មានសមាជិក",
"email": "អ៊ីមែល",
"enable-share-url": "បើកការចែករំលែក URL",
diff --git a/public/intl/messages/ko-KR.json b/public/intl/messages/ko-KR.json
index 5f929b100..28348f161 100644
--- a/public/intl/messages/ko-KR.json
+++ b/public/intl/messages/ko-KR.json
@@ -98,7 +98,6 @@
"download": "다운로드",
"dropoff": "이탈",
"edit": "편집",
- "edit-dashboard": "대시보드 편집",
"edit-member": "멤버 편집",
"email": "이메일",
"enable-share-url": "URL 공유 활성화",
diff --git a/public/intl/messages/lt-LT.json b/public/intl/messages/lt-LT.json
index eb0e888e5..0dd0eb24a 100644
--- a/public/intl/messages/lt-LT.json
+++ b/public/intl/messages/lt-LT.json
@@ -98,7 +98,6 @@
"download": "Atsisiųsti",
"dropoff": "Atsitraukimas",
"edit": "Redaguoti",
- "edit-dashboard": "Redaguoti švieslentę",
"edit-member": "Redaguoti narį",
"email": "El. paštas",
"enable-share-url": "Įjungti bendrinimą su nuoroda",
diff --git a/public/intl/messages/mn-MN.json b/public/intl/messages/mn-MN.json
index 4d16640df..5ebc08c2e 100644
--- a/public/intl/messages/mn-MN.json
+++ b/public/intl/messages/mn-MN.json
@@ -98,7 +98,6 @@
"download": "Татах",
"dropoff": "Уналт",
"edit": "Засах",
- "edit-dashboard": "Хянах самбар засах",
"edit-member": "Гишүүн засах",
"email": "Имэйл",
"enable-share-url": "Хуваалцах холбоос идэвхжүүлэх",
diff --git a/public/intl/messages/ms-MY.json b/public/intl/messages/ms-MY.json
index 23b68725c..e04a39f2d 100644
--- a/public/intl/messages/ms-MY.json
+++ b/public/intl/messages/ms-MY.json
@@ -98,7 +98,6 @@
"download": "Muat turun",
"dropoff": "Tercicir",
"edit": "Sunting",
- "edit-dashboard": "Sunting papan pemuka",
"edit-member": "Sunting ahli",
"email": "E-mel",
"enable-share-url": "Aktifkan url berkongsi",
diff --git a/public/intl/messages/my-MM.json b/public/intl/messages/my-MM.json
index 6f766125f..5e7a149ef 100644
--- a/public/intl/messages/my-MM.json
+++ b/public/intl/messages/my-MM.json
@@ -98,7 +98,6 @@
"download": "ဒေါင်းလုဒ်လုပ်မည်",
"dropoff": "ထွက်ခွာမှု",
"edit": "ပြုပြင်မည်",
- "edit-dashboard": "ဒက်ရှ်ဘုတ်ကို ပြုပြင်မည်",
"edit-member": "အဖွဲ့ဝင် ပြင်ဆင်မည်",
"email": "အီးမေးလ်",
"enable-share-url": "ဝေငှခြင်းကိုလင့်ကို ဖွင့်မည်",
diff --git a/public/intl/messages/nb-NO.json b/public/intl/messages/nb-NO.json
index ef1fd8ef4..6a70d7acd 100644
--- a/public/intl/messages/nb-NO.json
+++ b/public/intl/messages/nb-NO.json
@@ -98,7 +98,6 @@
"download": "Last ned",
"dropoff": "Frafall",
"edit": "Rediger",
- "edit-dashboard": "Rediger dashboard",
"edit-member": "Rediger bruker",
"email": "E-post",
"enable-share-url": "Aktiver delings-URL",
diff --git a/public/intl/messages/nl-NL.json b/public/intl/messages/nl-NL.json
index 6b1e7d88a..8e77a8818 100644
--- a/public/intl/messages/nl-NL.json
+++ b/public/intl/messages/nl-NL.json
@@ -98,7 +98,6 @@
"download": "Downloaden",
"dropoff": "Uitval",
"edit": "Bewerken",
- "edit-dashboard": "Dashboard aanpassen",
"edit-member": "Gebruiker aanpassen",
"email": "E-mail",
"enable-share-url": "Sta delen via openbare URL toe",
diff --git a/public/intl/messages/pl-PL.json b/public/intl/messages/pl-PL.json
index 081c8fcac..84d6cce9a 100644
--- a/public/intl/messages/pl-PL.json
+++ b/public/intl/messages/pl-PL.json
@@ -98,7 +98,6 @@
"download": "Pobierz",
"dropoff": "Odpływ",
"edit": "Edytuj",
- "edit-dashboard": "Edytuj panel",
"edit-member": "Edytuj członka",
"email": "E-mail",
"enable-share-url": "Włącz udostępnianie adresu URL",
diff --git a/public/intl/messages/pt-BR.json b/public/intl/messages/pt-BR.json
index dd7de79ad..338148f66 100644
--- a/public/intl/messages/pt-BR.json
+++ b/public/intl/messages/pt-BR.json
@@ -98,7 +98,6 @@
"download": "Download",
"dropoff": "Abandono",
"edit": "Editar",
- "edit-dashboard": "Editar painel",
"edit-member": "Editar membro",
"email": "E-mail",
"enable-share-url": "Ativar link para compartilhar",
diff --git a/public/intl/messages/pt-PT.json b/public/intl/messages/pt-PT.json
index 35e6a4ee1..eeb02d2fc 100644
--- a/public/intl/messages/pt-PT.json
+++ b/public/intl/messages/pt-PT.json
@@ -98,7 +98,6 @@
"download": "Transferir",
"dropoff": "Abandono",
"edit": "Editar",
- "edit-dashboard": "Editar painel",
"edit-member": "Editar membro",
"email": "E-mail",
"enable-share-url": "Ativar link de partilha",
diff --git a/public/intl/messages/ro-RO.json b/public/intl/messages/ro-RO.json
index dc7ddfdd1..f8a1457a6 100644
--- a/public/intl/messages/ro-RO.json
+++ b/public/intl/messages/ro-RO.json
@@ -98,7 +98,6 @@
"download": "Descarcă",
"dropoff": "Rată de abandon",
"edit": "Editare",
- "edit-dashboard": "Editare tablou de bord",
"edit-member": "Editare membru",
"email": "Email",
"enable-share-url": "Activare adresă URL de distribuire",
diff --git a/public/intl/messages/ru-RU.json b/public/intl/messages/ru-RU.json
index 6ed9c7a8a..5c05decc2 100644
--- a/public/intl/messages/ru-RU.json
+++ b/public/intl/messages/ru-RU.json
@@ -98,7 +98,6 @@
"download": "Скачать",
"dropoff": "Высадка",
"edit": "Изменить",
- "edit-dashboard": "Редактировать дашборд",
"edit-member": "Редактировать участника",
"email": "Электронная почта",
"enable-share-url": "Разрешить делиться ссылкой",
diff --git a/public/intl/messages/si-LK.json b/public/intl/messages/si-LK.json
index e42bf11a6..6d38e9d3a 100644
--- a/public/intl/messages/si-LK.json
+++ b/public/intl/messages/si-LK.json
@@ -98,7 +98,6 @@
"download": "බාගන්න",
"dropoff": "අතහැර යෑම",
"edit": "සංස්කරණය කරන්න",
- "edit-dashboard": "උපකරණ පුවරුව සංස්කරණය",
"edit-member": "සාමාජිකයා සංස්කරණය",
"email": "විද්‍යුත් තැපෑල",
"enable-share-url": "බෙදාගැනීමේ URL සබල කරන්න",
diff --git a/public/intl/messages/sk-SK.json b/public/intl/messages/sk-SK.json
index 00ea51ba1..517f5b953 100644
--- a/public/intl/messages/sk-SK.json
+++ b/public/intl/messages/sk-SK.json
@@ -98,7 +98,6 @@
"download": "Stiahnuť",
"dropoff": "Odchod",
"edit": "Upraviť",
- "edit-dashboard": "Upraviť prehľad",
"edit-member": "Upraviť člena",
"email": "E-mail",
"enable-share-url": "Povoliť zdielanie URL",
diff --git a/public/intl/messages/sl-SI.json b/public/intl/messages/sl-SI.json
index af1c9b6a8..85e7ee772 100644
--- a/public/intl/messages/sl-SI.json
+++ b/public/intl/messages/sl-SI.json
@@ -98,7 +98,6 @@
"download": "Prenesi",
"dropoff": "Zapustitev",
"edit": "Uredi",
- "edit-dashboard": "Uredi nadzorno ploščo",
"edit-member": "Uredi člana",
"email": "E-pošta",
"enable-share-url": "Omogoči povezavo za deljenje",
diff --git a/public/intl/messages/sv-SE.json b/public/intl/messages/sv-SE.json
index 85d1280a8..edcfb8966 100644
--- a/public/intl/messages/sv-SE.json
+++ b/public/intl/messages/sv-SE.json
@@ -98,7 +98,6 @@
"download": "Ladda ner",
"dropoff": "Bortfall",
"edit": "Redigera",
- "edit-dashboard": "Redigera översikt",
"edit-member": "Redigera medlem",
"email": "E-post",
"enable-share-url": "Aktivera delningslänk",
diff --git a/public/intl/messages/ta-IN.json b/public/intl/messages/ta-IN.json
index f9578fc5e..88c062216 100644
--- a/public/intl/messages/ta-IN.json
+++ b/public/intl/messages/ta-IN.json
@@ -98,7 +98,6 @@
"download": "பதிவிறக்கு",
"dropoff": "விலகல்",
"edit": "திருத்துதல்",
- "edit-dashboard": "முகப்பைத் திருத்து",
"edit-member": "உறுப்பினரைத் திருத்து",
"email": "மின்னஞ்சல்",
"enable-share-url": "கள முகவரியை பகிரலாம்",
diff --git a/public/intl/messages/th-TH.json b/public/intl/messages/th-TH.json
index 5d274aba8..901512031 100644
--- a/public/intl/messages/th-TH.json
+++ b/public/intl/messages/th-TH.json
@@ -98,7 +98,6 @@
"download": "ดาวน์โหลด",
"dropoff": "การออกจากระบบ",
"edit": "แก้ไข",
- "edit-dashboard": "แก้ไขแดชบอร์ด",
"edit-member": "แก้ไขสมาชิก",
"email": "อีเมล",
"enable-share-url": "เปิดใช้งานการแชร์ลิงก์",
diff --git a/public/intl/messages/tr-TR.json b/public/intl/messages/tr-TR.json
index 843df31fd..e176e0208 100644
--- a/public/intl/messages/tr-TR.json
+++ b/public/intl/messages/tr-TR.json
@@ -98,7 +98,6 @@
"download": "İndir",
"dropoff": "Bırakma",
"edit": "Düzenle",
- "edit-dashboard": "Kontrol panelini düzenle",
"edit-member": "Üyeyi düzenle",
"email": "E-posta",
"enable-share-url": "Anonim paylaşım URL'i aktif",
diff --git a/public/intl/messages/uk-UA.json b/public/intl/messages/uk-UA.json
index 94b8d3078..88711253d 100644
--- a/public/intl/messages/uk-UA.json
+++ b/public/intl/messages/uk-UA.json
@@ -98,7 +98,6 @@
"download": "Завантажити",
"dropoff": "Відсів",
"edit": "Редагувати",
- "edit-dashboard": "Редагувати панель",
"edit-member": "Редагувати учасника",
"email": "Електронна пошта",
"enable-share-url": "Увімкнути спільне посилання",
diff --git a/public/intl/messages/ur-PK.json b/public/intl/messages/ur-PK.json
index c8a520075..9bb0b13f9 100644
--- a/public/intl/messages/ur-PK.json
+++ b/public/intl/messages/ur-PK.json
@@ -98,7 +98,6 @@
"download": "ڈاؤن لوڈ",
"dropoff": "ڈراپ آف",
"edit": "ترمیم",
- "edit-dashboard": "ڈیش بورڈ میں ترمیم",
"edit-member": "رکن میں ترمیم",
"email": "ای میل",
"enable-share-url": "شیئر یو آر ایل کو فعال کریں",
diff --git a/public/intl/messages/uz-UZ.json b/public/intl/messages/uz-UZ.json
index 69738b8f6..cecaff713 100644
--- a/public/intl/messages/uz-UZ.json
+++ b/public/intl/messages/uz-UZ.json
@@ -98,7 +98,6 @@
"download": "Yuklab olish",
"dropoff": "Tashlab ketish",
"edit": "Tahrirlash",
- "edit-dashboard": "Boshqaruv panelini tahrirlash",
"edit-member": "A'zoni tahrirlash",
"email": "Elektron pochta",
"enable-share-url": "Ulashish URL'ini yoqish",
diff --git a/public/intl/messages/vi-VN.json b/public/intl/messages/vi-VN.json
index 6f027e5d7..f97601a41 100644
--- a/public/intl/messages/vi-VN.json
+++ b/public/intl/messages/vi-VN.json
@@ -98,7 +98,6 @@
"download": "Tải xuống",
"dropoff": "Tỷ lệ bỏ qua",
"edit": "Chỉnh sửa",
- "edit-dashboard": "Chỉnh sửa bảng điều khiển",
"edit-member": "Chỉnh sửa thành viên",
"email": "Email",
"enable-share-url": "Bật chia sẻ URL",
diff --git a/public/intl/messages/zh-CN.json b/public/intl/messages/zh-CN.json
index df162d83a..d16f5b858 100644
--- a/public/intl/messages/zh-CN.json
+++ b/public/intl/messages/zh-CN.json
@@ -98,7 +98,6 @@
"download": "下载",
"dropoff": "丢弃",
"edit": "编辑",
- "edit-dashboard": "编辑仪表盘",
"edit-member": "编辑成员",
"email": "邮箱",
"enable-share-url": "启用共享链接",
diff --git a/public/intl/messages/zh-TW.json b/public/intl/messages/zh-TW.json
index 396b2c34b..2e555a6d0 100644
--- a/public/intl/messages/zh-TW.json
+++ b/public/intl/messages/zh-TW.json
@@ -98,7 +98,6 @@
"download": "下載",
"dropoff": "離開",
"edit": "編輯",
- "edit-dashboard": "編輯儀表板",
"edit-member": "編輯成員",
"email": "電子郵件",
"enable-share-url": "啟用分享連結",
diff --git a/src/app/(main)/SideNav.tsx b/src/app/(main)/SideNav.tsx
index 6281fc900..7da6e5643 100644
--- a/src/app/(main)/SideNav.tsx
+++ b/src/app/(main)/SideNav.tsx
@@ -14,16 +14,33 @@ import { SettingsNav } from '@/app/(main)/settings/SettingsNav';
import { WebsiteNav } from '@/app/(main)/websites/[websiteId]/WebsiteNav';
import { IconLabel } from '@/components/common/IconLabel';
import { useGlobalState, useMessages, useNavigation } from '@/components/hooks';
-import { Globe, Grid2x2, LayoutDashboard, LinkIcon, PanelLeft } from '@/components/icons';
+import {
+ Globe,
+ Grid2x2,
+ LayoutDashboard,
+ LayoutGrid,
+ LinkIcon,
+ PanelLeft,
+} from '@/components/icons';
import { UserButton } from '@/components/input/UserButton';
import { Logo } from '@/components/svg';
export function SideNav(props: any) {
const { t, labels } = useMessages();
- const { pathname, renderUrl, websiteId } = useNavigation();
+ const { pathname, renderUrl, websiteId, teamId } = useNavigation();
const [isCollapsed] = useGlobalState('sidenav-collapsed', false);
const links = [
+ ...(!teamId
+ ? [
+ {
+ id: 'dashboard',
+ label: t(labels.dashboard),
+ path: '/dashboard',
+ icon: <LayoutGrid />,
+ },
+ ]
+ : []),
{
id: 'boards',
label: t(labels.boards),
diff --git a/src/app/(main)/boards/[boardId]/BoardComponentRenderer.tsx b/src/app/(main)/boards/[boardId]/BoardComponentRenderer.tsx
index c029de878..3609e9b9e 100644
--- a/src/app/(main)/boards/[boardId]/BoardComponentRenderer.tsx
+++ b/src/app/(main)/boards/[boardId]/BoardComponentRenderer.tsx
@@ -8,7 +8,7 @@ function BoardComponentRendererComponent({
websiteId,
}: {
config: BoardComponentConfig;
- websiteId: string;
+ websiteId?: string;
}) {
const definition = getComponentDefinition(config.type);
@@ -22,6 +22,14 @@ function BoardComponentRendererComponent({
const Component = definition.component;
+ if (!websiteId) {
+ return (
+ <Column alignItems="center" justifyContent="center" width="100%" height="100%">
+ <Text color="muted">Select a website</Text>
+ </Column>
+ );
+ }
+
return <Component websiteId={websiteId} {...config.props} />;
}
diff --git a/src/app/(main)/boards/[boardId]/BoardComponentSelect.tsx b/src/app/(main)/boards/[boardId]/BoardComponentSelect.tsx
index d36b9014f..a8f250c73 100644
--- a/src/app/(main)/boards/[boardId]/BoardComponentSelect.tsx
+++ b/src/app/(main)/boards/[boardId]/BoardComponentSelect.tsx
@@ -11,6 +11,7 @@ import {
import { useEffect, useMemo, useState } from 'react';
import { Panel } from '@/components/common/Panel';
import { useMessages } from '@/components/hooks';
+import { WebsiteSelect } from '@/components/input/WebsiteSelect';
import type { BoardComponentConfig } from '@/lib/types';
import {
CATEGORIES,
@@ -21,12 +22,16 @@ import {
import { BoardComponentRenderer } from './BoardComponentRenderer';
export function BoardComponentSelect({
+ teamId,
websiteId,
+ defaultWebsiteId,
initialConfig,
onSelect,
onClose,
}: {
- websiteId: string;
+ teamId?: string;
+ websiteId?: string;
+ defaultWebsiteId?: string;
initialConfig?: BoardComponentConfig;
onSelect: (config: BoardComponentConfig) => void;
onClose: () => void;
@@ -34,6 +39,9 @@ export function BoardComponentSelect({
const { t, labels, messages } = useMessages();
const [selectedDef, setSelectedDef] = useState<ComponentDefinition | null>(null);
const [configValues, setConfigValues] = useState<Record<string, any>>({});
+ const [selectedWebsiteId, setSelectedWebsiteId] = useState(
+ initialConfig?.websiteId || websiteId || defaultWebsiteId,
+ );
const [title, setTitle] = useState('');
const [description, setDescription] = useState('');
@@ -73,9 +81,10 @@ export function BoardComponentSelect({
setSelectedDef(definition);
setConfigValues(getDefaultConfigValues(definition, initialConfig));
+ setSelectedWebsiteId(initialConfig.websiteId || websiteId || defaultWebsiteId);
setTitle(initialConfig.title ?? '');
setDescription(initialConfig.description || '');
- }, [initialConfig, allDefinitions]);
+ }, [initialConfig, allDefinitions, websiteId, defaultWebsiteId]);
const handleSelectComponent = (def: ComponentDefinition) => {
setSelectedDef(def);
@@ -107,6 +116,7 @@ export function BoardComponentSelect({
const config: BoardComponentConfig = {
type: selectedDef.type,
+ websiteId: selectedWebsiteId,
title,
description,
};
@@ -172,12 +182,14 @@ export function BoardComponentSelect({
<Column gap="3" flexGrow={1} style={{ minWidth: 0 }}>
<Panel maxHeight="100%">
- {previewConfig && websiteId ? (
- <BoardComponentRenderer config={previewConfig} websiteId={websiteId} />
+ {previewConfig && selectedWebsiteId ? (
+ <BoardComponentRenderer config={previewConfig} websiteId={selectedWebsiteId} />
) : (
<Column alignItems="center" justifyContent="center" height="100%">
<Text color="muted">
- {websiteId ? t(messages.selectComponentPreview) : t(messages.selectWebsiteFirst)}
+ {selectedWebsiteId
+ ? t(messages.selectComponentPreview)
+ : t(messages.selectWebsiteFirst)}
</Text>
</Column>
)}
@@ -187,6 +199,18 @@ export function BoardComponentSelect({
<Column gap="3" style={{ width: 320, flexShrink: 0, overflowY: 'auto' }}>
<Text weight="bold">{t(labels.properties)}</Text>
+ <Column gap="2">
+ <Text size="sm" color="muted">
+ {t(labels.website)}
+ </Text>
+ <WebsiteSelect
+ websiteId={selectedWebsiteId}
+ teamId={teamId}
+ placeholder={t(labels.selectWebsite)}
+ onChange={setSelectedWebsiteId}
+ />
+ </Column>
+
<Column gap="2">
<Text size="sm" color="muted">
{t(labels.title)}
diff --git a/src/app/(main)/boards/[boardId]/BoardEditBody.tsx b/src/app/(main)/boards/[boardId]/BoardEditBody.tsx
index d9c366fb0..a6df61bb5 100644
--- a/src/app/(main)/boards/[boardId]/BoardEditBody.tsx
+++ b/src/app/(main)/boards/[boardId]/BoardEditBody.tsx
@@ -8,7 +8,7 @@ import { GripHorizontal, Plus } from '@/components/icons';
import { BoardEditRow } from './BoardEditRow';
import { BUTTON_ROW_HEIGHT, MAX_ROW_HEIGHT, MIN_ROW_HEIGHT } from './boardConstants';
-export function BoardEditBody() {
+export function BoardEditBody({ requiresBoardWebsite = true }: { requiresBoardWebsite?: boolean }) {
const { board, updateBoard, registerLayoutGetter } = useBoard();
const rowGroupRef = useRef<GroupImperativeHandle>(null);
const columnGroupRefs = useRef<Map<string, GroupImperativeHandle>>(new Map());
@@ -103,6 +103,7 @@ export function BoardEditBody() {
};
const websiteId = board?.parameters?.websiteId;
+ const canEdit = requiresBoardWebsite ? !!websiteId : true;
const rows = board?.parameters?.rows ?? [];
const minHeight = (rows.length || 1) * MAX_ROW_HEIGHT + BUTTON_ROW_HEIGHT;
@@ -122,7 +123,7 @@ export function BoardEditBody() {
rowId={row.id}
rowIndex={index}
rowCount={rows.length}
- canEdit={!!websiteId}
+ canEdit={canEdit}
onRemove={handleRemoveRow}
onMoveUp={handleMoveRowUp}
onMoveDown={handleMoveRowDown}
@@ -157,7 +158,7 @@ export function BoardEditBody() {
)}
</Fragment>
))}
- {!!websiteId && (
+ {canEdit && (
<Panel minSize={BUTTON_ROW_HEIGHT}>
<Row padding="3">
<TooltipTrigger delay={0}>
diff --git a/src/app/(main)/boards/[boardId]/BoardEditColumn.tsx b/src/app/(main)/boards/[boardId]/BoardEditColumn.tsx
index 4075d64f2..266a78971 100644
--- a/src/app/(main)/boards/[boardId]/BoardEditColumn.tsx
+++ b/src/app/(main)/boards/[boardId]/BoardEditColumn.tsx
@@ -11,7 +11,7 @@ import {
} from '@umami/react-zen';
import { useMemo, useState } from 'react';
import { Panel } from '@/components/common/Panel';
-import { useBoard, useMessages } from '@/components/hooks';
+import { useBoard, useMessages, useNavigation } from '@/components/hooks';
import { Pencil, Plus, X } from '@/components/icons';
import type { BoardComponentConfig } from '@/lib/types';
import { BoardComponentRenderer } from './BoardComponentRenderer';
@@ -36,7 +36,9 @@ export function BoardEditColumn({
const [showActions, setShowActions] = useState(false);
const { board } = useBoard();
const { t, labels } = useMessages();
- const websiteId = board?.parameters?.websiteId;
+ const { teamId } = useNavigation();
+ const boardWebsiteId = board?.parameters?.websiteId;
+ const websiteId = component?.websiteId || boardWebsiteId;
const renderedComponent = useMemo(() => {
if (!component || !websiteId) {
return null;
@@ -126,7 +128,9 @@ export function BoardEditColumn({
>
{() => (
<BoardComponentSelect
+ teamId={teamId}
websiteId={websiteId}
+ defaultWebsiteId={boardWebsiteId}
initialConfig={component}
onSelect={handleSelect}
onClose={() => setShowSelect(false)}
diff --git a/src/app/(main)/boards/[boardId]/BoardViewColumn.tsx b/src/app/(main)/boards/[boardId]/BoardViewColumn.tsx
index 293ee3b0f..4a5909eda 100644
--- a/src/app/(main)/boards/[boardId]/BoardViewColumn.tsx
+++ b/src/app/(main)/boards/[boardId]/BoardViewColumn.tsx
@@ -6,7 +6,7 @@ import { BoardComponentRenderer } from './BoardComponentRenderer';
export function BoardViewColumn({ component }: { component?: BoardComponentConfig }) {
const { board } = useBoard();
- const websiteId = board?.parameters?.websiteId;
+ const websiteId = component?.websiteId || board?.parameters?.websiteId;
if (!component || !websiteId) {
return null;
diff --git a/src/app/(main)/dashboard/DashboardEditHeader.tsx b/src/app/(main)/dashboard/DashboardEditHeader.tsx
new file mode 100644
index 000000000..a450c85ca
--- /dev/null
+++ b/src/app/(main)/dashboard/DashboardEditHeader.tsx
@@ -0,0 +1,27 @@
+import { Button, LoadingButton, Row } from '@umami/react-zen';
+import { PageHeader } from '@/components/common/PageHeader';
+import { useBoard, useMessages, useNavigation } from '@/components/hooks';
+
+export function DashboardEditHeader() {
+ const { saveBoard, isPending } = useBoard();
+ const { t, labels } = useMessages();
+ const { router, renderUrl } = useNavigation();
+
+ const handleSave = async () => {
+ await saveBoard();
+ router.push(renderUrl('/dashboard', false));
+ };
+
+ return (
+ <PageHeader title={t(labels.dashboard)}>
+ <Row gap="3">
+ <Button variant="quiet" onPress={() => router.push(renderUrl('/dashboard', false))}>
+ {t(labels.cancel)}
+ </Button>
+ <LoadingButton variant="primary" onPress={handleSave} isLoading={isPending}>
+ {t(labels.save)}
+ </LoadingButton>
+ </Row>
+ </PageHeader>
+ );
+}
diff --git a/src/app/(main)/dashboard/DashboardEditPage.tsx b/src/app/(main)/dashboard/DashboardEditPage.tsx
new file mode 100644
index 000000000..be3aa54c9
--- /dev/null
+++ b/src/app/(main)/dashboard/DashboardEditPage.tsx
@@ -0,0 +1,33 @@
+'use client';
+import { Column } from '@umami/react-zen';
+import { useEffect } from 'react';
+import { BoardEditBody } from '@/app/(main)/boards/[boardId]/BoardEditBody';
+import { PageBody } from '@/components/common/PageBody';
+import { useNavigation } from '@/components/hooks';
+import { DashboardEditHeader } from './DashboardEditHeader';
+import { DashboardProvider } from './DashboardProvider';
+
+export function DashboardEditPage() {
+ const { teamId, router } = useNavigation();
+
+ useEffect(() => {
+ if (teamId) {
+ router.replace('/dashboard/edit');
+ }
+ }, [teamId, router]);
+
+ if (teamId) {
+ return null;
+ }
+
+ return (
+ <DashboardProvider editing>
+ <PageBody>
+ <Column>
+ <DashboardEditHeader />
+ <BoardEditBody requiresBoardWebsite={false} />
+ </Column>
+ </PageBody>
+ </DashboardProvider>
+ );
+}
diff --git a/src/app/(main)/dashboard/DashboardPage.tsx b/src/app/(main)/dashboard/DashboardPage.tsx
deleted file mode 100644
index 81bb9719d..000000000
--- a/src/app/(main)/dashboard/DashboardPage.tsx
+++ /dev/null
@@ -1,17 +0,0 @@
-'use client';
-import { Column } from '@umami/react-zen';
-import { PageBody } from '@/components/common/PageBody';
-import { PageHeader } from '@/components/common/PageHeader';
-import { useMessages } from '@/components/hooks';
-
-export function DashboardPage() {
- const { t, labels } = useMessages();
-
- return (
- <PageBody>
- <Column margin="2">
- <PageHeader title={t(labels.dashboard)}></PageHeader>
- </Column>
- </PageBody>
- );
-}
diff --git a/src/app/(main)/dashboard/DashboardProvider.tsx b/src/app/(main)/dashboard/DashboardProvider.tsx
new file mode 100644
index 000000000..96e4aacf5
--- /dev/null
+++ b/src/app/(main)/dashboard/DashboardProvider.tsx
@@ -0,0 +1,111 @@
+'use client';
+import { Loading, useToast } from '@umami/react-zen';
+import { type ReactNode, useCallback, useEffect, useRef, useState } from 'react';
+import { v4 as uuid } from 'uuid';
+import { BoardContext, type LayoutGetter } from '@/app/(main)/boards/BoardProvider';
+import { getComponentDefinition } from '@/app/(main)/boards/boardComponentRegistry';
+import { useApi, useDashboardQuery, useMessages, useModified } from '@/components/hooks';
+import type { Board, BoardParameters } from '@/lib/types';
+
+const createDefaultBoard = (): Partial<Board> => ({
+ name: '',
+ description: '',
+ parameters: {
+ rows: [{ id: uuid(), columns: [{ id: uuid(), component: null }] }],
+ },
+});
+
+function sanitizeBoardParameters(parameters?: BoardParameters): BoardParameters | undefined {
+ if (!parameters?.rows) {
+ return parameters;
+ }
+
+ return {
+ ...parameters,
+ rows: parameters.rows.map(row => ({
+ ...row,
+ columns: row.columns.map(column => {
+ if (column.component && !getComponentDefinition(column.component.type)) {
+ return {
+ ...column,
+ component: null,
+ };
+ }
+
+ return column;
+ }),
+ })),
+ };
+}
+
+export function DashboardProvider({
+ editing = false,
+ children,
+}: {
+ editing?: boolean;
+ children: ReactNode;
+}) {
+ const { data, isFetching, isLoading } = useDashboardQuery();
+ const { post, useMutation } = useApi();
+ const { touch } = useModified();
+ const { toast } = useToast();
+ const { t, labels, messages } = useMessages();
+ const [board, setBoard] = useState<Partial<Board>>(data ?? createDefaultBoard());
+ const layoutGetterRef = useRef<LayoutGetter | null>(null);
+
+ const registerLayoutGetter = useCallback((getter: LayoutGetter) => {
+ layoutGetterRef.current = getter;
+ }, []);
+
+ useEffect(() => {
+ if (data) {
+ setBoard({
+ ...data,
+ parameters: sanitizeBoardParameters(data.parameters),
+ });
+ }
+ }, [data]);
+
+ const { mutateAsync, isPending } = useMutation({
+ mutationFn: (boardData: Partial<Board>) => {
+ return post('/dashboard', boardData);
+ },
+ });
+
+ const updateBoard = useCallback((data: Partial<Board>) => {
+ setBoard(current => ({ ...current, ...data }));
+ }, []);
+
+ const saveBoard = useCallback(async () => {
+ const dashboardName = t(labels.dashboard);
+ const layoutData = layoutGetterRef.current?.();
+ const parameters = sanitizeBoardParameters(
+ layoutData ? { ...board.parameters, ...layoutData } : board.parameters,
+ );
+
+ const result = await mutateAsync({
+ ...board,
+ name: dashboardName,
+ description: '',
+ parameters,
+ });
+
+ toast(t(messages.saved));
+ touch('dashboard');
+ touch('boards');
+
+ return result;
+ }, [board, labels.dashboard, messages.saved, mutateAsync, t, toast, touch]);
+
+ if (isFetching && isLoading) {
+ return <Loading placement="absolute" />;
+ }
+
+ return (
+ <BoardContext.Provider
+ value={{ board, editing, updateBoard, saveBoard, isPending, registerLayoutGetter }}
+ >
+ {children}
+ </BoardContext.Provider>
+ );
+}
diff --git a/src/app/(main)/dashboard/DashboardViewHeader.tsx b/src/app/(main)/dashboard/DashboardViewHeader.tsx
new file mode 100644
index 000000000..6385e80ba
--- /dev/null
+++ b/src/app/(main)/dashboard/DashboardViewHeader.tsx
@@ -0,0 +1,18 @@
+import { IconLabel } from '@/components/common/IconLabel';
+import { LinkButton } from '@/components/common/LinkButton';
+import { PageHeader } from '@/components/common/PageHeader';
+import { useMessages, useNavigation } from '@/components/hooks';
+import { Edit } from '@/components/icons';
+
+export function DashboardViewHeader() {
+ const { t, labels } = useMessages();
+ const { renderUrl } = useNavigation();
+
+ return (
+ <PageHeader title={t(labels.dashboard)}>
+ <LinkButton href={renderUrl('/dashboard/edit', false)}>
+ <IconLabel icon={<Edit />}>{t(labels.edit)}</IconLabel>
+ </LinkButton>
+ </PageHeader>
+ );
+}
diff --git a/src/app/(main)/dashboard/DashboardViewPage.tsx b/src/app/(main)/dashboard/DashboardViewPage.tsx
new file mode 100644
index 000000000..1ed1977ac
--- /dev/null
+++ b/src/app/(main)/dashboard/DashboardViewPage.tsx
@@ -0,0 +1,49 @@
+'use client';
+import { Column } from '@umami/react-zen';
+import { useEffect } from 'react';
+import { BoardViewBody } from '@/app/(main)/boards/[boardId]/BoardViewBody';
+import { EmptyPlaceholder } from '@/components/common/EmptyPlaceholder';
+import { PageBody } from '@/components/common/PageBody';
+import { useBoard, useMessages, useNavigation } from '@/components/hooks';
+import { DashboardProvider } from './DashboardProvider';
+import { DashboardViewHeader } from './DashboardViewHeader';
+
+function DashboardContent() {
+ const { board } = useBoard();
+ const { t, labels, messages } = useMessages();
+ const rows = board?.parameters?.rows ?? [];
+ const hasComponents = rows.some(row => row.columns?.some(column => !!column.component));
+
+ if (!hasComponents) {
+ return (
+ <EmptyPlaceholder title={t(labels.dashboard)} description={t(messages.emptyDashboard)} />
+ );
+ }
+
+ return <BoardViewBody />;
+}
+
+export function DashboardViewPage() {
+ const { teamId, router } = useNavigation();
+
+ useEffect(() => {
+ if (teamId) {
+ router.replace('/dashboard');
+ }
+ }, [teamId, router]);
+
+ if (teamId) {
+ return null;
+ }
+
+ return (
+ <DashboardProvider>
+ <PageBody>
+ <Column>
+ <DashboardViewHeader />
+ <DashboardContent />
+ </Column>
+ </PageBody>
+ </DashboardProvider>
+ );
+}
diff --git a/src/app/(main)/dashboard/edit/page.tsx b/src/app/(main)/dashboard/edit/page.tsx
new file mode 100644
index 000000000..bda115a92
--- /dev/null
+++ b/src/app/(main)/dashboard/edit/page.tsx
@@ -0,0 +1,10 @@
+import type { Metadata } from 'next';
+import { DashboardEditPage } from '../DashboardEditPage';
+
+export default function () {
+ return <DashboardEditPage />;
+}
+
+export const metadata: Metadata = {
+ title: 'Edit Dashboard',
+};
diff --git a/src/app/(main)/dashboard/page.tsx b/src/app/(main)/dashboard/page.tsx
index 4b79b598f..185f36b7c 100644
--- a/src/app/(main)/dashboard/page.tsx
+++ b/src/app/(main)/dashboard/page.tsx
@@ -1,8 +1,8 @@
import type { Metadata } from 'next';
-import { DashboardPage } from './DashboardPage';
+import { DashboardViewPage } from './DashboardViewPage';
export default async function () {
- return <DashboardPage />;
+ return <DashboardViewPage />;
}
export const metadata: Metadata = {
diff --git a/src/app/api/dashboard/route.ts b/src/app/api/dashboard/route.ts
new file mode 100644
index 000000000..92c8e4c14
--- /dev/null
+++ b/src/app/api/dashboard/route.ts
@@ -0,0 +1,64 @@
+import { z } from 'zod';
+import { uuid } from '@/lib/crypto';
+import { parseRequest } from '@/lib/request';
+import { json, unauthorized } from '@/lib/response';
+import { createBoard, getBoard, updateBoard } from '@/queries/prisma';
+
+export async function GET(request: Request) {
+ const { auth, error } = await parseRequest(request);
+
+ if (error) {
+ return error();
+ }
+
+ const board = await getBoard(auth.user.id);
+
+ if (board && board.userId !== auth.user.id) {
+ return unauthorized();
+ }
+
+ return json(board);
+}
+
+export async function POST(request: Request) {
+ const schema = z.object({
+ name: z.string().optional(),
+ description: z.string().optional(),
+ parameters: z.object({}).passthrough().optional(),
+ });
+
+ const { auth, body, error } = await parseRequest(request, schema);
+
+ if (error) {
+ return error();
+ }
+
+ const userId = auth.user.id;
+ const existing = await getBoard(userId);
+
+ if (existing && existing.userId !== userId) {
+ return unauthorized();
+ }
+
+ const data = {
+ name: body.name,
+ description: body.description,
+ parameters: body.parameters ?? {},
+ };
+
+ if (existing) {
+ const result = await updateBoard(userId, data);
+
+ return json(result);
+ }
+
+ const result = await createBoard({
+ id: userId,
+ type: 'dashboard',
+ slug: uuid(),
+ userId,
+ ...data,
+ });
+
+ return json(result);
+}
diff --git a/src/components/hooks/index.ts b/src/components/hooks/index.ts
index b92d4ed82..d6b4340a2 100644
--- a/src/components/hooks/index.ts
+++ b/src/components/hooks/index.ts
@@ -13,6 +13,7 @@ export * from './context/useWebsite';
export * from './queries/useActiveUsersQuery';
export * from './queries/useBoardQuery';
export * from './queries/useBoardsQuery';
+export * from './queries/useDashboardQuery';
export * from './queries/useDateRangeQuery';
export * from './queries/useDeleteQuery';
export * from './queries/useEventDataEventsQuery';
diff --git a/src/components/hooks/queries/useDashboardQuery.ts b/src/components/hooks/queries/useDashboardQuery.ts
new file mode 100644
index 000000000..a5afd39b6
--- /dev/null
+++ b/src/components/hooks/queries/useDashboardQuery.ts
@@ -0,0 +1,16 @@
+import { keepPreviousData } from '@tanstack/react-query';
+import type { ReactQueryOptions } from '@/lib/types';
+import { useApi } from '../useApi';
+import { useModified } from '../useModified';
+
+export function useDashboardQuery(options?: ReactQueryOptions) {
+ const { get, useQuery } = useApi();
+ const { modified } = useModified('dashboard');
+
+ return useQuery({
+ queryKey: ['dashboard', { modified }],
+ queryFn: () => get('/dashboard'),
+ placeholderData: keepPreviousData,
+ ...options,
+ });
+}
diff --git a/src/components/input/WebsiteSelect.tsx b/src/components/input/WebsiteSelect.tsx
index 02198a99c..3fd28cdd2 100644
--- a/src/components/input/WebsiteSelect.tsx
+++ b/src/components/input/WebsiteSelect.tsx
@@ -24,7 +24,7 @@ export function WebsiteSelect({
includeTeams?: boolean;
isCollapsed?: boolean;
} & SelectProps) {
- const { t, messages } = useMessages();
+ const { t, labels, messages } = useMessages();
const { data: website } = useWebsiteQuery(websiteId);
const [name, setName] = useState<string>(website?.name);
const [search, setSearch] = useState('');
@@ -57,12 +57,16 @@ export function WebsiteSelect({
return '';
}
+ const value = name || props.placeholder || t(labels.selectWebsite);
+
return (
<Row alignItems="center" gap>
<Icon>
<Globe />
</Icon>
- <Text truncate>{name}</Text>
+ <Text truncate color={name ? undefined : 'muted'}>
+ {value}
+ </Text>
</Row>
);
};
diff --git a/src/components/messages.ts b/src/components/messages.ts
index 955324ba6..b8b4c0161 100644
--- a/src/components/messages.ts
+++ b/src/components/messages.ts
@@ -155,7 +155,6 @@ export const labels: Record<string, string> = {
tablet: 'label.tablet',
mobile: 'label.mobile',
toggleCharts: 'label.toggle-charts',
- editDashboard: 'label.edit-dashboard',
title: 'label.title',
view: 'label.view',
cities: 'label.cities',
@@ -368,6 +367,7 @@ export const messages: Record<string, string> = {
noResultsFound: 'message.no-results-found',
noWebsitesConfigured: 'message.no-websites-configured',
noTeamWebsites: 'message.no-team-websites',
+ emptyDashboard: 'message.empty-dashboard',
selectComponentPreview: 'message.select-component-preview',
selectWebsiteFirst: 'message.select-website-first',
teamWebsitesInfo: 'message.team-websites-info',
diff --git a/src/lib/types.ts b/src/lib/types.ts
index e2501742d..fd8f1e42b 100644
--- a/src/lib/types.ts
+++ b/src/lib/types.ts
@@ -146,6 +146,7 @@ export interface ApiError extends Error {
export interface BoardComponentConfig {
type: string;
+ websiteId?: string;
title?: string;
description?: string;
props?: Record<string, any>;