135 Commits

Author SHA1 Message Date
Alexis
6b01ce181d Added back breadcrumb 2025-04-29 16:16:45 +02:00
Alexis
acb5c0d92f Added middleware for closing sidebar on route change 2025-04-29 09:34:58 +02:00
Alexis
387597755d Added sidebar toggle 2025-04-29 09:28:49 +02:00
Alexis
a5f7e1ded9 Added first sidebar draft 2025-04-28 17:18:06 +02:00
Alexis
93a03ca4e2 Removed breadcrumbs on mobile 2025-04-28 12:27:10 +02:00
Alexis
a6fe4c7ea3 Categories appear on more options 2025-04-28 11:29:33 +02:00
Alexis
805972bf3c Fixed css color issue 2025-04-26 21:16:35 +02:00
Alexis
c071e9c33b Added some transitions 2025-04-26 21:01:52 +02:00
Alexis
b430ab2660 Changed head description 2025-04-26 20:32:31 +02:00
Alexis
a6d388f5da Added missing description to event creation dialog 2025-04-26 20:19:11 +02:00
Alexis
a03b7890e6 Made dialog go full screen on mobile 2025-04-25 21:30:40 +02:00
Alexis
b71e715cf5 Fixed call stack issue 2025-04-25 21:06:19 +02:00
Alexis
9ba09c2d2b Fixed black button for day tile 2025-04-25 17:56:56 +02:00
Alexis
b1ff2ec232 Changed today CTA on mobile 2025-04-25 17:53:40 +02:00
Alexis
093b4e7493 Fixed overflow issues on search 2025-04-25 17:36:54 +02:00
Alexis
7b0bb1e939 Made event creation dialog behaviour the same 2025-04-25 17:33:45 +02:00
Alexis
60bbb6f48f Fixed no contrast event buttons 2025-04-25 17:30:50 +02:00
Alexis
f502f80341 Updated list style 2025-04-25 17:25:01 +02:00
Alexis
e634cc8127 Fixed some inconsistencies 2025-04-25 16:56:09 +02:00
Alexis
ee29169f4f Added transitions for client only buttons 2025-04-25 15:38:37 +02:00
Alexis
2d2069cae6 Fixed hydration mismatches 2025-04-25 15:23:03 +02:00
Alexis
f7f12feaec Changed popover to modal on small screens 2025-04-25 14:58:47 +02:00
Alexis
5b8fedba7c Added space-x for alert dialog 2025-04-25 14:17:48 +02:00
Alexis
fa872e6914 Fixed collision padding for calendar events 2025-04-25 14:15:20 +02:00
Alexis
43dd12782b Reduced spacing on calendar menu 2025-04-23 21:59:45 +02:00
Alexis
f1f140f2bc Reduced some spacing on mobile 2025-04-23 21:41:32 +02:00
Alexis
707d4374ef Changed calendar layout for buttons 2025-04-23 16:21:51 +02:00
AlexisNP
048413286f Merge pull request #77 from AlexisNP/upgrade/nuxt
Upgrade/nuxt
2025-04-23 14:11:29 +02:00
Alexis
9d06040c5d Changed muted colour 2025-04-22 22:30:14 +02:00
Alexis
15bfc66087 Removed dark classes for calendar preview 2025-04-22 22:15:49 +02:00
Alexis
e6b2670438 Removed character string 2025-04-22 17:17:13 +02:00
Alexis
e2d2810db6 Event creation form closes if the date changes 2025-04-22 17:07:29 +02:00
Alexis
1827b9118f Changed chip colour for tags input 2025-04-22 15:36:58 +02:00
Alexis
086b997845 Fixed default breadcrumb look 2025-04-22 15:31:41 +02:00
Alexis
73f5e01244 Removed default lucide icons and updated some packages 2025-04-22 14:09:25 +02:00
Alexis
d02bfacd57 Made search bigger 2025-04-18 18:07:13 +02:00
Alexis
5370a9df06 Added color square to event creation forms 2025-04-18 18:03:55 +02:00
Alexis
5bd76495f4 Added color square to category filter 2025-04-18 17:59:49 +02:00
Alexis
7480447420 Standardized tilde imports for non modules 2025-04-18 17:44:21 +02:00
Alexis
034713961b Changed card color for calendars and worlds 2025-04-18 17:35:02 +02:00
Alexis
00224417be Cleaned up most vanilla try catches 2025-04-18 17:11:45 +02:00
Alexis
9b4556245e Fixed hardcoded world id for calendar creation 2025-04-17 22:34:52 +02:00
Alexis
ad8120bdd0 Removed useless lazy directives 2025-04-17 22:14:10 +02:00
Alexis
73bd79c3c5 Fixed hydration error 2025-04-17 21:47:25 +02:00
Alexis
8215791830 Changed h-w to size 2025-04-17 21:41:48 +02:00
AlexisNP
36456ce377 Merge pull request #76 from AlexisNP/upgrade/tailwind-4
Upgrade/tailwind 4
2025-04-17 19:58:02 +02:00
Alexis
015d0c4db4 Moved bgc colors to relevant file 2025-04-17 17:22:01 +02:00
Alexis
392d8cd8ec Fixed dialog animation issues 2025-04-17 17:02:42 +02:00
Alexis
473c69c9a1 Updated packages 2025-04-17 16:55:51 +02:00
Alexis
790deeec5d Updated border and event colors 2025-04-17 16:42:48 +02:00
Alexis
687b96cf12 Moved event and colored element logic to css variables 2025-04-16 19:52:19 +02:00
Alexis
3e973dd0e9 "Working" config with tailwind 4 and shadcn nuxt 2025-04-16 12:14:27 +02:00
Alexis
cc07f898ea Ran upgrade cli 2025-04-16 12:00:38 +02:00
AlexisNP
e5bc5c8a41 Merge pull request #74 from AlexisNP/features/category-management
Features/category management
2025-04-16 10:59:11 +02:00
Alexis
2faefa32ef Fixed plural typo 2025-04-16 10:55:41 +02:00
Alexis
d681c45a1e Fixed deleted toast message 2025-04-16 10:53:55 +02:00
Alexis
db6ae36743 Fixed short id calendar page data 2025-04-16 10:50:39 +02:00
Alexis
6abf89e8db Moved categories to the same scope as calendar events 2025-04-16 10:49:11 +02:00
Alexis
f1abae1cce Fixed client side error 2025-04-15 21:09:02 +02:00
Alexis
a50824bd4f Cleaned up more console logs 2025-04-15 20:34:01 +02:00
Alexis
ed1252add4 Cleanup console logs 2025-04-15 20:33:41 +02:00
Alexis
1e0d840b41 Added category deletion interface 2025-04-15 20:32:03 +02:00
Alexis
58f3783b13 Added category creation interface 2025-04-15 15:34:05 +02:00
Alexis
c25c10f7b7 Fixed categories not updating 2025-04-15 11:18:26 +02:00
Alexis
f00e049f76 Added toast messages 2025-04-06 16:18:09 +02:00
Alexis
02fba36421 Add watch function if categories change 2025-04-06 16:08:45 +02:00
Alexis
aa76b17c37 Changed lazy fetch for reactive store data 2025-04-06 15:45:26 +02:00
Alexis
b32fab81f6 Added category update 2025-04-06 14:41:46 +02:00
Alexis
8005a8e9a2 Added read only category table 2025-03-31 19:10:11 +02:00
Alexis
d4d74db5d9 Refactored some stuff 2025-03-30 16:48:30 +02:00
Alexis
637a5cd7e3 Added sample behaviour for category modal 2025-03-28 20:54:12 +01:00
Alexis
2856185a3c Display category menu cta only if not read only 2025-03-28 15:34:30 +01:00
Alexis
d3a1ff92e2 Added option menu for calendar 2025-03-28 15:23:38 +01:00
Alexis
d2295024bd Changed span to kbd 2025-03-28 12:12:37 +01:00
Alexis
149d0794e3 Moved navigation to sub nav 2025-03-28 12:11:54 +01:00
Alexis
7f3a2b8d56 Fixed long RLS name 2025-03-15 14:52:26 +01:00
Alexis
6992bca957 Changed hidden translations 2025-03-14 22:30:10 +01:00
Alexis
f3fd97e3cd Changed categories to be linked to calendars and worlds 2025-03-14 22:25:50 +01:00
Alexis
e6b82e9b85 Merge branch 'code/cleanup' into dev 2025-03-14 18:21:56 +01:00
Alexis
15458ab5fd Fixed col size for world / calendar 2025-03-14 18:17:04 +01:00
Alexis
6add25f45f Fixed grid lines for calendars 2025-03-14 18:10:45 +01:00
Alexis
1bee00ffd6 Minimized sidebar bg 2025-03-14 18:03:48 +01:00
Alexis
404174de31 Merge branch 'code/cleanup' into dev 2025-03-14 17:45:15 +01:00
Alexis
5b38b3d0fa Added loading card component 2025-03-14 17:45:09 +01:00
Alexis
586adee6a9 Fixed calendar spacing without breadcrumbs 2025-03-14 16:56:53 +01:00
Alexis
f94c688baa Accessible event button styles 2025-03-14 16:47:43 +01:00
Alexis
9034406a45 Set initial focus for event search 2025-03-14 15:49:36 +01:00
Alexis
9e814e319f Set initial focus event creation 2025-03-14 15:38:19 +01:00
AlexisNP
a1dc761904 Merge pull request #71 from AlexisNP/features/revamp-sidebar
Features/revamp sidebar
2025-03-14 12:17:55 +01:00
Alexis
c3c4554e09 Fixed calendar grid colours 2025-03-14 12:15:36 +01:00
Alexis
c249dc8334 Fixed regression on new event popover closing
The setTimeout isn't good for reseting the skeleton ; it basically overrides the next time we open another day to add an event
2025-03-14 12:10:46 +01:00
Alexis
895d8a887b Removed sidebar and added breadcrumbs 2025-03-14 12:07:03 +01:00
Alexis
0126d42762 Fixed data loading timing issue 2025-03-13 22:11:19 +01:00
Alexis
1de5f13df6 Added reset menu to explorer 2025-03-13 18:25:27 +01:00
Alexis
f0e3fc2167 Changed the way the sidebar works 2025-03-13 18:25:04 +01:00
Alexis
fdb77a20f3 Added catch layout for error pages 2025-03-13 12:25:34 +01:00
Alexis
2cdf793e67 Removed unused setting link 2025-03-12 21:05:20 +01:00
AlexisNP
d7b299e0eb Merge pull request #70 from AlexisNP/bugfix/events-date
Bugfix/events date
2025-03-11 13:41:35 +01:00
Alexis
04ecbe1c2b Fixed more clone issues 2025-03-11 13:33:44 +01:00
Alexis
267ed70f5a Fixed reactive clone issues 2025-03-11 13:32:18 +01:00
AlexisNP
2716e6d559 Merge pull request #69 from AlexisNP/features/draft-published-state
Features/draft published state
2025-03-10 21:58:21 +01:00
Alexis
5664204fce Applied color to preview calendar card 2025-03-10 21:50:43 +01:00
Alexis
e0d5f679b0 Added client side realtime for calendars 2025-03-10 21:42:04 +01:00
Alexis
ae8937e7a6 Added update channel to calendar 2025-03-07 21:36:10 +01:00
Alexis
655f5d20f3 Added state on calendar preview 2025-03-07 18:56:21 +01:00
Alexis
965452671b Fixed RLS issues for calendars 2025-03-07 18:35:14 +01:00
Alexis
31a4316186 Commit stuff in case my computer explodes 2025-03-06 20:34:59 +01:00
Alexis
d46da12745 Added fix for calendar update channel 2025-03-05 20:21:33 +01:00
Alexis
1aa3350da3 Fixed a bug with dates and some style issues 2025-03-05 20:03:52 +01:00
Alexis
8848fa75b1 Fixed RLS and added visual feedback on dashboard 2025-03-05 16:34:53 +01:00
Alexis
282aabb7fa Added state selector for world 2025-03-04 19:02:27 +01:00
Alexis
204de011f6 Merge branch 'code/cleanup' into dev 2025-03-04 18:30:06 +01:00
Alexis
d73fe93812 Fixed event skeleton not being reset on edit close 2025-03-04 14:15:57 +01:00
Alexis
5df57ee587 Merge branch 'code/cleanup' into dev 2025-03-04 13:59:02 +01:00
Alexis
3f4cb46ebf Added timestamps for calendars 2025-03-03 23:13:13 +01:00
Alexis
922bcdc64b Added a bunch of mini features
Sorted worlds, add preview and add cards, added timestamps...
2025-03-03 22:27:42 +01:00
Alexis
a83bc240b1 Added ui card to add worlds / calendars 2025-03-03 12:35:59 +01:00
Alexis
7e2989e383 Polished world modal behaviour 2025-03-02 20:02:51 +01:00
Alexis
71866b0e4b Fixed focus issues on modals closing 2025-03-01 14:37:47 +01:00
Alexis
ba3eb29e04 Added world edit subscription
And also toast lifetimes
2025-03-01 14:14:55 +01:00
Alexis
189f0eec75 Fixed readOnly status for calendar 2025-03-01 13:19:02 +01:00
AlexisNP
4dbd80fa80 Merge pull request #64 from AlexisNP/features/hidden-events-revamp
Features/hidden events revamp
2025-02-28 23:11:21 +01:00
Alexis
b2ec583a09 Fixed style for hiddent white events 2025-02-28 23:08:16 +01:00
Alexis
d663253a05 Changed style of event callouts 2025-02-28 23:04:26 +01:00
Alexis
0cc6d0f1ee Changed style of event details button 2025-02-28 22:55:39 +01:00
Alexis
9cc0eabe3c Made user cta button more visible 2025-02-28 22:27:47 +01:00
Alexis
2e63836b80 Merge branch 'code/cleanup' into dev 2025-02-28 21:55:57 +01:00
Alexis
fe035da7c3 Added edit world functions 2025-02-28 19:24:53 +01:00
Alexis
04940aacc3 Formatted data calls and removed svg bg 2025-02-28 17:25:03 +01:00
Alexis
d04cee2d12 Fixed 404 pages 2025-02-28 17:14:42 +01:00
Alexis
879ff732ef Added sidebar bg image 2025-02-28 16:20:52 +01:00
Alexis
500941ae69 Revamped world slug code 2025-02-28 14:34:57 +01:00
Alexis
d6d173d087 Fixed loading syntax for calendar 2025-02-28 13:42:09 +01:00
Alexis
c59d4eaf92 Added compatibility date ? 2025-02-27 22:28:08 +01:00
Alexis
60755fd46f Merge branch 'update' into dev 2025-02-27 22:25:35 +01:00
216 changed files with 8992 additions and 4807 deletions

1
.nvmrc Normal file
View File

@@ -0,0 +1 @@
20.12.0

28
app.vue
View File

@@ -1,5 +1,6 @@
<script setup lang="ts">
import { ConfigProvider } from "radix-vue"
import { cn } from "./lib/utils";
useHead({
titleTemplate: (titleChunk) => {
@@ -26,6 +27,8 @@ useHead({
})
const useIdFunction = () => useId()
const { isSidebarOpened } = storeToRefs(useUiStore())
</script>
<template>
@@ -34,10 +37,18 @@ const useIdFunction = () => useId()
<NuxtLayout>
<ConfigProvider :use-id="useIdFunction">
<div class="h-full grid grid-cols-[auto_1fr] dark:bg-black transition-colors">
<div
class="h-full grid md:grid-cols-[auto_1fr] dark:bg-black shadow-body-light dark:shadow-body-dark transition-colors after:absolute after:transition-colors"
:class="cn({
'max-md:after:bg-transparent': isSidebarOpened,
'has-sidebar max-md:after:bg-black/20 md:after:opacity-0 md:after:pointer-events-none': isSidebarOpened
})"
>
<Sidebar />
<div class="wrapper shadow-body-light dark:shadow-body-dark transition-all">
<div
class="wrapper max-h-screen transition-all"
>
<NuxtPage />
</div>
</div>
@@ -54,4 +65,17 @@ const useIdFunction = () => useId()
.wrapper > * {
height: 100%;
}
.has-sidebar {
position: relative;
isolation: isolate;
&::after {
content: '';
display: block;
position: fixed;
inset: 0;
z-index: 30;
}
}
</style>

326
assets/_colors.css Normal file
View File

@@ -0,0 +1,326 @@
:root {
--event-red-foreground: var(--color-slate-900);
--event-red-background: var(--color-red-500);
--event-orange-foreground: var(--color-slate-900);
--event-orange-background: var(--color-orange-500);
--event-amber-foreground: var(--color-slate-900);
--event-amber-background: var(--color-amber-500);
--event-yellow-foreground: var(--color-slate-900);
--event-yellow-background: var(--color-yellow-500);
--event-lime-foreground: var(--color-slate-900);
--event-lime-background: var(--color-lime-500);
--event-green-foreground: var(--color-white);
--event-green-background: var(--color-green-600);
--event-emerald-foreground: var(--color-white);
--event-emerald-background: var(--color-emerald-600);
--event-teal-foreground: var(--color-white);
--event-teal-background: var(--color-teal-600);
--event-cyan-foreground: var(--color-white);
--event-cyan-background: var(--color-cyan-600);
--event-sky-foreground: var(--color-white);
--event-sky-background: var(--color-sky-600);
--event-blue-foreground: var(--color-white);
--event-blue-background: var(--color-blue-600);
--event-indigo-foreground: var(--color-white);
--event-indigo-background: var(--color-indigo-600);
--event-violet-foreground: var(--color-white);
--event-violet-background: var(--color-violet-600);
--event-purple-foreground: var(--color-white);
--event-purple-background: var(--color-purple-600);
--event-fuchsia-foreground: var(--color-white);
--event-fuchsia-background: var(--color-fuchsia-700);
--event-pink-foreground: var(--color-white);
--event-pink-background: var(--color-pink-700);
--event-rose-foreground: var(--color-white);
--event-rose-background: var(--color-pink-700);
--event-black-foreground: var(--color-white);
--event-black-background: var(--color-stone-500);
--event-white-foreground: var(--color-slate-900);
--event-white-background: var(--color-lime-100);
}
@theme inline {
--color-event-red-foreground: var(--event-red-foreground);
--color-event-red-background: var(--event-red-background);
--color-event-orange-foreground: var(--event-orange-foreground);
--color-event-orange-background: var(--event-orange-background);
--color-event-amber-foreground: var(--event-amber-foreground);
--color-event-amber-background: var(--event-amber-background);
--color-event-yellow-foreground: var(--event-yellow-foreground);
--color-event-yellow-background: var(--event-yellow-background);
--color-event-lime-foreground: var(--event-lime-foreground);
--color-event-lime-background: var(--event-lime-background);
--color-event-green-foreground: var(--event-green-foreground);
--color-event-green-background: var(--event-green-background);
--color-event-emerald-foreground: var(--event-emerald-foreground);
--color-event-emerald-background: var(--event-emerald-background);
--color-event-teal-foreground: var(--event-teal-foreground);
--color-event-teal-background: var(--event-teal-background);
--color-event-cyan-foreground: var(--event-cyan-foreground);
--color-event-cyan-background: var(--event-cyan-background);
--color-event-sky-foreground: var(--event-sky-foreground);
--color-event-sky-background: var(--event-sky-background);
--color-event-blue-foreground: var(--event-blue-foreground);
--color-event-blue-background: var(--event-blue-background);
--color-event-indigo-foreground: var(--event-indigo-foreground);
--color-event-indigo-background: var(--event-indigo-background);
--color-event-violet-foreground: var(--event-violet-foreground);
--color-event-violet-background: var(--event-violet-background);
--color-event-purple-foreground: var(--event-purple-foreground);
--color-event-purple-background: var(--event-purple-background);
--color-event-fuchsia-foreground: var(--event-fuchsia-foreground);
--color-event-fuchsia-background: var(--event-fuchsia-background);
--color-event-pink-foreground: var(--event-pink-foreground);
--color-event-pink-background: var(--event-pink-background);
--color-event-rose-foreground: var(--event-rose-foreground);
--color-event-rose-background: var(--event-rose-background);
--color-event-black-foreground: var(--event-black-foreground);
--color-event-black-background: var(--event-black-background);
--color-event-white-foreground: var(--event-white-foreground);
--color-event-white-background: var(--event-white-background);
}
.event-button,
.event-popover,
.event-callout,
.card-color {
--fg-color: var(--color-foreground);
--bg-color: var(--color-background);
transition-duration: var(--default-transition-duration);
transition-timing-function: var(--default-transition-timing-function);
}
.event-callout hr,
.card-color hr {
transition-property: border-color;
transition-duration: var(--default-transition-duration);
transition-timing-function: var(--default-transition-timing-function);
}
.event-button {
color: var(--fg-color);
background-color: var(--bg-color);
text-underline-offset: .15rem;
transition-property: background-color, color;
}
.event-button:hover {
text-decoration: underline;
background-color: color-mix(in srgb, var(--bg-color) 70%, var(--color-background));
}
.event-button.is-hidden {
background-color: transparent;
color: var(--color-foreground);
border: 1px dashed var(--bg-color);
transition-property: background-color, color, border-color;
}
.event-button.is-hidden:is(:hover, :focus-visible) {
background-color: color-mix(in srgb, var(--bg-color) 70%, var(--color-background));
color: var(--fg-color);
}
.event-popover {
background-color: color-mix(in srgb, var(--bg-color) 10%, var(--color-background));
border-color: color-mix(in srgb, var(--bg-color) 50%, var(--color-background));
transition-property: background-color, color;
hr {
border-color: var(--bg-color);
}
}
.event-callout {
position: relative;
background-color: color-mix(in srgb, var(--bg-color) 10%, var(--color-background));
border-top-right-radius: .2rem;
border-bottom-right-radius: .2rem;
transition-property: background-color, color;
hr {
border-color: var(--bg-color);
}
}
.event-callout::before {
display: block;
content: '';
position: absolute;
height: 100%;
inset-block: 0;
left: -0.5rem;
width: .5rem;
background-color: color-mix(in srgb, var(--bg-color) 70%, var(--color-background));
border-top-left-radius: .2rem;
border-bottom-left-radius: .2rem;
transition-property: background-color;
transition-duration: var(--default-transition-duration);
transition-timing-function: var(--default-transition-timing-function);
}
.event-callout:is(:hover, :focus-visible) {
background-color: color-mix(in srgb, var(--bg-color) 30%, var(--color-background));
}
.event-callout:is(:hover, :focus-visible)::before {
background-color: color-mix(in srgb, var(--bg-color) 90%, var(--color-background));
}
.event-callout.is-hidden {
border: 1px dashed var(--bg-color);
background-color: transparent;
}
.event-callout.is-hidden::before {
inset-block: -2px;
height: calc(100% + 3px);
background-color: color-mix(in srgb, var(--bg-color) 40%, var(--color-background));
}
.event-callout.is-hidden:is(:hover, :focus-visible) {
background-color: color-mix(in srgb, var(--bg-color) 5%, var(--color-background));
}
.event-callout.is-hidden:is(:hover, :focus-visible)::before {
background-color: color-mix(in srgb, var(--bg-color) 50%, var(--color-background));
}
.card-color {
border-color: color-mix(in srgb, var(--bg-color) 30%, var(--color-background));
background-color: color-mix(in srgb, var(--bg-color) 10%, var(--color-background));
hr {
border-color: color-mix(in srgb, var(--bg-color) 30%, var(--color-background))
}
}
.card-color:is(:hover, :focus-visible) {
border-color: color-mix(in srgb, var(--bg-color) 40%, var(--color-background));
background-color: color-mix(in srgb, var(--bg-color) 20%, var(--color-background));
hr {
border-color: color-mix(in srgb, var(--bg-color) 40%, var(--color-background))
}
}
.bgc {
display: flex;
align-items: center;
flex-wrap: nowrap;
}
.bgc::before {
content: "";
display: inline-block;
width: .75rem;
aspect-ratio: 1;
margin-right: 0.5em;
border-radius: .25rem;
background-color: var(--bg-color);
border: 1px solid transparent;
}
.element-red {
--fg-color: var(--color-event-red-foreground);
--bg-color: var(--color-event-red-background);
}
.element-orange {
--fg-color: var(--color-event-orange-foreground);
--bg-color: var(--color-event-orange-background);
}
.element-amber {
--fg-color: var(--color-event-amber-foreground);
--bg-color: var(--color-event-amber-background);
}
.element-yellow {
--fg-color: var(--color-event-yellow-foreground);
--bg-color: var(--color-event-yellow-background);
}
.element-lime {
--fg-color: var(--color-event-lime-foreground);
--bg-color: var(--color-event-lime-background);
}
.element-green {
--fg-color: var(--color-event-green-foreground);
--bg-color: var(--color-event-green-background);
}
.element-emerald {
--fg-color: var(--color-event-emerald-foreground);
--bg-color: var(--color-event-emerald-background);
}
.element-teal {
--fg-color: var(--color-event-teal-foreground);
--bg-color: var(--color-event-teal-background);
}
.element-cyan {
--fg-color: var(--color-event-cyan-foreground);
--bg-color: var(--color-event-cyan-background);
}
.element-sky {
--fg-color: var(--color-event-sky-foreground);
--bg-color: var(--color-event-sky-background);
}
.element-blue {
--fg-color: var(--color-event-blue-foreground);
--bg-color: var(--color-event-blue-background);
}
.element-indigo {
--fg-color: var(--color-event-indigo-foreground);
--bg-color: var(--color-event-indigo-background);
}
.element-violet {
--fg-color: var(--color-event-violet-foreground);
--bg-color: var(--color-event-violet-background);
}
.element-purple {
--fg-color: var(--color-event-purple-foreground);
--bg-color: var(--color-event-purple-background);
}
.element-fuchsia {
--fg-color: var(--color-event-fuchsia-foreground);
--bg-color: var(--color-event-fuchsia-background);
}
.element-pink {
--fg-color: var(--color-event-pink-foreground);
--bg-color: var(--color-event-pink-background);
}
.element-rose {
--fg-color: var(--color-event-rose-foreground);
--bg-color: var(--color-event-rose-background);
}
.element-black {
--fg-color: var(--color-event-black-foreground);
--bg-color: var(--color-event-black-background);
}
.element-white {
--fg-color: var(--color-event-white-foreground);
--bg-color: var(--color-event-white-background);
}

4
assets/_typography.css Normal file
View File

@@ -0,0 +1,4 @@
@theme inline {
--text-2xs: 0.7rem;
--text-2xs--line-height: 0.75rem;
}

View File

@@ -1,279 +1,33 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
@import 'tailwindcss';
@config '../tailwind.config.js';
@import "./theme.css" layer(theme);
@import "./_typography.css" layer(theme);
@import "./_colors.css" layer(theme);
@import "./_colors.css" layer(utilities);
/*
The default border color has changed to `currentcolor` in Tailwind CSS v4,
so we've added these compatibility styles to make sure everything still
looks the same as it did with Tailwind CSS v3.
If we ever want to remove these styles, we need to add an explicit border
color utility to any element that depends on these defaults.
*/
@layer base {
:root {
--background: 0 0% 100%;
--foreground: 222.2 84% 4.9%;
--muted: 210 40% 96.1%;
--muted-foreground: 215.4 16.3% 46.9%;
--popover: 0 0% 100%;
--popover-foreground: 222.2 84% 4.9%;
--card: 0 0% 100%;
--card-foreground: 222.2 84% 4.9%;
--border: 214.3 31.8% 91.4%;
--input: 214.3 31.8% 91.4%;
--primary: 245 58% 51%;
--primary-foreground: 0 0% 100%;
--secondary: 210 40% 96.1%;
--secondary-foreground: 222.2 47.4% 11.2%;
--accent: 210 40% 96.1%;
--accent-foreground: 222.2 47.4% 11.2%;
--destructive: 0 84.2% 60.2%;
--destructive-foreground: 210 40% 98%;
--success: 156 72% 67%;
--success-muted: 156 72% 90%;
--success-foreground: 222.2 84% 4.9%;
--ring: 222.2 84% 4.9%;
--radius: 0.5rem;
}
.dark {
--background: 180 0 4.9%;
--foreground: 210 40% 98%;
--muted: 244 47% 20%;
--muted-foreground: 215 20.2% 65.1%;
--popover: 180 0 4.9%;
--popover-foreground: 210 40% 98%;
--card: 180 0 4.9%;
--card-foreground: 210 40% 98%;
--border: 217 0 10%;
--input: 244 47% 20%;
--primary: 245 58% 51%;
--primary-foreground: 0 0% 100%;
--secondary: 244 47% 20%;
--secondary-foreground: 210 40% 98%;
--accent: 244 47% 20%;
--accent-foreground: 210 40% 98%;
--destructive: 0 62.8% 30.6%;
--destructive-foreground: 210 40% 98%;
--success: 142 72% 29%;
--success-muted: 142 72% 10%;
--success-foreground: 210 40% 98%;
--ring: 212.7 26.8% 83.9%;
*,
::after,
::before,
::backdrop,
::file-selector-button {
border-color: var(--color-border, currentcolor);
}
}
@layer base {
* {
@apply border-border;
}
body {
@apply bg-background text-foreground;
}
}
/* Colors */
.event-red {
@apply text-slate-900 bg-red-500 hover:bg-red-600
}
.event-orange {
@apply text-slate-900 bg-orange-500 hover:bg-orange-600
}
.event-amber {
@apply text-slate-900 bg-amber-500 hover:bg-amber-600
}
.event-yellow {
@apply text-slate-900 bg-yellow-600 hover:bg-yellow-700
}
.event-lime {
@apply text-slate-900 bg-lime-500 hover:bg-lime-600
}
.event-green {
@apply text-white bg-green-600 hover:bg-green-700
}
.event-emerald {
@apply text-white bg-emerald-600 hover:bg-emerald-700
}
.event-teal {
@apply text-white bg-teal-600 hover:bg-teal-700
}
.event-cyan {
@apply text-white bg-cyan-600 hover:bg-cyan-700
}
.event-sky {
@apply text-white bg-sky-600 hover:bg-sky-700
}
.event-blue {
@apply text-white bg-blue-600 hover:bg-blue-700
}
.event-indigo {
@apply text-white bg-indigo-600 hover:bg-indigo-700
}
.event-violet {
@apply text-white bg-violet-600 hover:bg-violet-700
}
.event-purple {
@apply text-white bg-purple-600 hover:bg-purple-700
}
.event-fuchsia {
@apply text-white bg-fuchsia-600 hover:bg-fuchsia-700
}
.event-pink {
@apply text-white bg-pink-700 hover:bg-pink-800
}
.event-rose {
@apply text-white bg-rose-700 hover:bg-rose-800
}
.event-black {
@apply text-white bg-stone-500 hover:bg-stone-700
}
.event-white {
@apply text-slate-900 bg-white hover:bg-yellow-200 border-[1px] border-slate-300
}
.dark .event-details-red {
--base-color: var(--color-red-800);
}
.dark .event-details-orange {
--base-color: var(--color-orange-800);
}
.dark .event-details-amber {
--base-color: var(--color-amber-800);
}
.dark .event-details-yellow {
--base-color: var(--color-yellow-800);
}
.dark .event-details-lime {
--base-color: var(--color-lime-800);
}
.dark .event-details-green {
--base-color: var(--color-green-800);
}
.dark .event-details-emerald {
--base-color: var(--color-emerald-800);
}
.dark .event-details-teal {
--base-color: var(--color-teal-800);
}
.dark .event-details-cyan {
--base-color: var(--color-cyan-800);
}
.dark .event-details-sky {
--base-color: var(--color-sky-800);
}
.dark .event-details-blue {
--base-color: var(--color-blue-800);
}
.dark .event-details-indigo {
--base-color: var(--color-indigo-800);
}
.dark .event-details-violet {
--base-color: var(--color-violet-800);
}
.dark .event-details-purple {
--base-color: var(--color-purple-800);
}
.dark .event-details-fuchsia {
--base-color: var(--color-fuchsia-800);
}
.dark .event-details-pink {
--base-color: var(--color-pink-800);
}
.dark .event-details-rose {
--base-color: var(--color-rose-800);
}
.dark .event-details-black {
--base-color: var(--color-stone-800);
}
.dark .event-details-white {
--base-color: var(--color-white);
}
.event-details-red {
--base-color: var(--color-red-300);
}
.event-details-orange {
--base-color: var(--color-orange-300);
}
.event-details-amber {
--base-color: var(--color-amber-300);
}
.event-details-yellow {
--base-color: var(--color-yellow-300);
}
.event-details-lime {
--base-color: var(--color-lime-300);
}
.event-details-green {
--base-color: var(--color-green-300);
}
.event-details-emerald {
--base-color: var(--color-emerald-300);
}
.event-details-teal {
--base-color: var(--color-teal-300);
}
.event-details-cyan {
--base-color: var(--color-cyan-300);
}
.event-details-sky {
--base-color: var(--color-sky-300);
}
.event-details-blue {
--base-color: var(--color-blue-300);
}
.event-details-indigo {
--base-color: var(--color-indigo-300);
}
.event-details-violet {
--base-color: var(--color-violet-300);
}
.event-details-purple {
--base-color: var(--color-purple-300);
}
.event-details-fuchsia {
--base-color: var(--color-fuchsia-300);
}
.event-details-pink {
--base-color: var(--color-pink-300);
}
.event-details-rose {
--base-color: var(--color-rose-300);
}
.event-details-black {
--base-color: var(--color-stone-300);
}
.event-details-white {
--base-color: var(--color-white);
}
.event-details {
--bg-color: color-mix(in srgb, var(--base-color), var(--color-white) 80%);
--border-color: color-mix(in srgb, var(--base-color), var(--color-white) 50%);
background-color: var(--bg-color);
border-color: var(--border-color);
hr {
border-color: var(--border-color);
}
}
.dark .event-details {
--bg-color: color-mix(in srgb, var(--base-color), var(--color-slate-950) 80%);
--border-color: color-mix(in srgb, var(--base-color), var(--color-slate-800) 50%);
body {
color: var(--color-foreground);
background-color: var(--color-background);
}
.fade-enter-active,

108
assets/theme.css Normal file
View File

@@ -0,0 +1,108 @@
:root {
--background: hsl(0 0% 100%);
--foreground: hsl(222.2 84% 4.9%);
--muted: hsl(210 40% 96.1%);
--muted-foreground: hsl(215.4 16.3% 46.9%);
--popover: hsl(0 0% 100%);
--popover-foreground: hsl(222.2 84% 4.9%);
--card: hsl(0 0% 100%);
--card-foreground: hsl(222.2 84% 4.9%);
--border: hsl(214.3 31.8% 91.4%);
--input: hsl(214.3 31.8% 91.4%);
--primary: hsl(245 58% 51%);
--primary-foreground: hsl(0 0% 100%);
--secondary: hsl(210 50% 95%);
--secondary-foreground: hsl(222.2 47.4% 11.2%);
--accent: hsl(210 40% 96.1%);
--accent-foreground: hsl(222.2 47.4% 11.2%);
--destructive: hsl(0 84.2% 60.2%);
--destructive-foreground: hsl(210 40% 98%);
--success: hsl(156 72% 67%);
--success-muted: hsl(156 72% 90%);
--success-foreground: hsl(222.2 84% 4.9%);
--ring: hsl(222.2 84% 4.9%);
--radius: 0.5rem;
}
.dark {
--background: hsl(180 0 4.9%);
--foreground: hsl(210 40% 98%);
--muted: hsl(0, 0%, 12%);
--muted-foreground: hsl(215 20.2% 65.1%);
--popover: hsl(180 0 4.9%);
--popover-foreground: hsl(210 40% 98%);
--card: hsl(180 0 4.9%);
--card-foreground: hsl(210 40% 98%);
--border: hsl(0, 0%, 16%);
--input: hsl(244 47% 20%);
--primary: hsl(245 58% 51%);
--primary-foreground: hsl(0 0% 100%);
--secondary: hsl(244 47% 20%);
--secondary-foreground: hsl(210 40% 98%);
--accent: hsl(244 47% 20%);
--accent-foreground: hsl(210 40% 98%);
--destructive: hsl(0 62.8% 30.6%);
--destructive-foreground: hsl(210 40% 98%);
--success: hsl(142 72% 29%);
--success-muted: hsl(142 72% 10%);
--success-foreground: hsl(210 40% 98%);
--ring: hsl(212.7 26.8% 83.9%);
--radius: 0.5rem;
}
@theme inline {
--color-background: var(--background);
--color-foreground: var(--foreground);
--color-muted: var(--muted);
--color-muted-foreground: var(--muted-foreground);
--color-popover: var(--popover);
--color-popover-foreground: var(--popover-foreground);
--color-card: var(--card);
--color-card-foreground: var(--card-foreground);
--color-border: var(--border);
--color-input: var(--input);
--color-primary: var(--primary);
--color-primary-foreground: var(--primary-foreground);
--color-secondary: var(--secondary);
--color-secondary-foreground: var(--secondary-foreground);
--color-accent: var(--accent);
--color-accent-foreground: var(--accent-foreground);
--color-destructive: var(--destructive);
--color-destructive-foreground: var(--destructive-foreground);
--color-success: var(--success);
--color-success-muted: var(--success-muted);
--color-success-foreground: var(--success-foreground);
--color-ring: var(--ring);
}

View File

@@ -1,5 +1,5 @@
<script lang="ts" setup>
import { useCalendar } from "@/stores/CalendarStore"
import { useCalendar } from "~/stores/CalendarStore"
import { computed, type Component, type ComputedRef } from "vue"
// import { PhMagnifyingGlass } from '@phosphor-icons/vue'
@@ -8,17 +8,6 @@ import CenturyLayout from "./state/centennially/Layout.vue"
import DecadeLayout from "./state/decennially/Layout.vue"
import YearLayout from "./state/yearly/Layout.vue"
import type { Calendar } from "~/models/CalendarConfig"
import type { Category } from "~/models/Category"
const props = defineProps<{
calendarData: Calendar,
categories: Category[]
}>()
const { setActiveCalendar } = useCalendar()
setActiveCalendar(props.calendarData, props.categories)
const { currentConfig, jumpToDate, selectedDate } = useCalendar()
const { isReadOnly } = storeToRefs(useCalendar())
@@ -46,14 +35,15 @@ onMounted(() => {
<template>
<div class="h-full w-full relative">
<div class="h-full grid grid-rows-[auto,1fr]">
<div class="h-full grid grid-rows-[auto_1fr]">
<CalendarMenu />
<component :is="currentViewComponent" />
<CalendarSearch />
<CalendarDialogUpdateEvent v-if="!isReadOnly" />
<CalendarDialogDeleteEvent v-if="!isReadOnly" />
<LazyCalendarDialogCategories v-if="!isReadOnly" />
<LazyCalendarDialogUpdateEvent v-if="!isReadOnly" />
<LazyCalendarDialogDeleteEvent v-if="!isReadOnly" />
</div>
</div>
</template>

View File

@@ -1,32 +0,0 @@
<script lang="ts" setup>
import { storeToRefs } from "pinia"
import { computed } from "vue"
import { PhMapPin } from "@phosphor-icons/vue"
const { defaultDate, getFormattedDateTitle, getRelativeString } = useCalendar()
const { selectedDate } = storeToRefs(useCalendar())
const mainDateTitle = computed(() => getFormattedDateTitle(selectedDate.value, true))
// const mainDateTitle = computed(() => convertDateToDays(selectedDate.value))
const dateDifference = computed(() => getRelativeString(defaultDate, selectedDate.value))
</script>
<template>
<ClientOnly>
<h1 class="text-2xl font-bold flex items-center gap-1">
<PhMapPin size="26" weight="bold" /> {{ mainDateTitle }}
</h1>
<h2 class="text-lg italic opacity-75">
{{ dateDifference }}
</h2>
<template #fallback>
<div class="grid gap-1">
<UiSkeleton class="h-8 w-64" />
<UiSkeleton class="h-6 w-28" />
</div>
</template>
</ClientOnly>
</template>

View File

@@ -1,47 +0,0 @@
<script lang="ts" setup>
import { useCalendar } from "@/stores/CalendarStore"
import { PhMagnifyingGlass } from "@phosphor-icons/vue"
const { revealAdvancedSearch } = useCalendar()
const { isReadOnly } = storeToRefs(useCalendar())
</script>
<template>
<header class="pt-4 border-slate-400 dark:border-slate-700 border-b-[1px]">
<div class="px-6 flex justify-between">
<menu class="flex items-center gap-2">
<li v-if="!isReadOnly">
<CalendarDialogQuickCreateEvent />
</li>
<li>
<CalendarMenuToday />
</li>
<li>
<CalendarMenuNav />
</li>
<li class="ml-6">
<CalendarCurrentDate />
</li>
</menu>
<menu class="flex items-center gap-2">
<li>
<UiButton search-slash @click="revealAdvancedSearch()">
<PhMagnifyingGlass size="20" weight="light" />
{{ $t('entity.advancedSearch.title') }}
</UiButton>
</li>
<li>
<ClientOnly>
<CalendarSwitch />
</ClientOnly>
</li>
</menu>
</div>
<div class="ml-6">
<CalendarMenuSubnav />
</div>
</header>
</template>

View File

@@ -1,200 +0,0 @@
<script lang="ts" setup>
import { computed, type ComputedRef } from "vue"
import { useCalendar } from "@/stores/CalendarStore"
import {
PhCaretDoubleLeft,
PhCaretDoubleRight,
PhCaretLeft,
PhCaretRight
} from "@phosphor-icons/vue"
const { t } = useI18n()
interface DirectionLabels {
pastFar: string
pastNear: string
futureNear: string
futureFar: string
}
const { currentConfig, decrementViewMonth, incrementViewMonth, decrementViewYear, incrementViewYear } =
useCalendar()
const activeDirectionLabels: ComputedRef<DirectionLabels> = computed(() => {
switch (currentConfig.viewType) {
case "month":
return {
pastFar: t("entity.calendar.years.prevSingular"),
pastNear: t("entity.calendar.months.prevSingular"),
futureNear: t("entity.calendar.months.nextSingular"),
futureFar: t("entity.calendar.years.nextSingular")
}
case "year":
return {
pastFar: t("entity.calendar.decades.prevSingular"),
pastNear: t("entity.calendar.years.prevSingular"),
futureNear: t("entity.calendar.years.nextSingular"),
futureFar: t("entity.calendar.decades.nextSingular")
}
case "decade":
return {
pastFar: t("entity.calendar.centuries.prevSingular"),
pastNear: t("entity.calendar.decades.prevSingular"),
futureNear: t("entity.calendar.decades.nextSingular"),
futureFar: t("entity.calendar.centuries.nextSingular")
}
case "century":
default:
return {
pastFar: t("entity.calendar.millenias.prevSingular"),
pastNear: t("entity.calendar.centuries.prevSingular"),
futureNear: t("entity.calendar.centuries.nextSingular"),
futureFar: t("entity.calendar.millenias.nextSingular")
}
}
})
function toPastFar(): void {
switch (currentConfig.viewType) {
case "month":
decrementViewYear()
break
case "year":
decrementViewYear(10)
break
case "decade":
decrementViewYear(100)
break
case "century":
default:
decrementViewYear(1000)
break
}
}
function toPastNear(): void {
switch (currentConfig.viewType) {
case "month":
decrementViewMonth()
break
case "year":
decrementViewYear()
break
case "decade":
decrementViewYear(10)
break
case "century":
default:
decrementViewYear(100)
break
}
}
function toFutureNear(): void {
switch (currentConfig.viewType) {
case "month":
incrementViewMonth()
break
case "year":
incrementViewYear()
break
case "decade":
incrementViewYear(10)
break
case "century":
default:
incrementViewYear(100)
break
}
}
function toFutureFar(): void {
switch (currentConfig.viewType) {
case "month":
incrementViewYear()
break
case "year":
incrementViewYear(10)
break
case "decade":
incrementViewYear(100)
break
case "century":
default:
incrementViewYear(1000)
break
}
}
</script>
<template>
<div class="flex items-center gap-2">
<UiTooltipProvider :delay-duration="250">
<UiTooltip>
<UiTooltipTrigger as-child>
<UiButton variant="outline" size="icon" @click="toPastFar()">
<PhCaretDoubleLeft size="18" />
</UiButton>
</UiTooltipTrigger>
<UiTooltipContent>
<p>{{ activeDirectionLabels.pastFar }}</p>
</UiTooltipContent>
</UiTooltip>
</UiTooltipProvider>
<UiTooltipProvider :delay-duration="250">
<UiTooltip>
<UiTooltipTrigger as-child>
<UiButton variant="outline" size="icon" @click="toPastNear()">
<PhCaretLeft size="18" />
</UiButton>
</UiTooltipTrigger>
<UiTooltipContent>
<p>{{ activeDirectionLabels.pastNear }}</p>
</UiTooltipContent>
</UiTooltip>
</UiTooltipProvider>
<UiTooltipProvider :delay-duration="250">
<UiTooltip>
<UiTooltipTrigger as-child>
<UiButton variant="outline" size="icon" @click="toFutureNear()">
<PhCaretRight size="18" />
</UiButton>
</UiTooltipTrigger>
<UiTooltipContent>
<p>{{ activeDirectionLabels.futureNear }}</p>
</UiTooltipContent>
</UiTooltip>
</UiTooltipProvider>
<UiTooltipProvider :delay-duration="250">
<UiTooltip>
<UiTooltipTrigger as-child>
<UiButton variant="outline" size="icon" @click="toFutureFar()">
<PhCaretDoubleRight size="18" />
</UiButton>
</UiTooltipTrigger>
<UiTooltipContent>
<p>{{ activeDirectionLabels.futureFar }}</p>
</UiTooltipContent>
</UiTooltip>
</UiTooltipProvider>
</div>
</template>

View File

@@ -1,122 +0,0 @@
<script lang="ts" setup>
const { currentDate } = useCalendar()
// const { toast } = useToast()
// const { t } = useI18n()
// function handleGotoPreviousEventPage(position: "next" | "prev" = "next") {
// let fromDate: RPGDate
// // To modify, obviously
// const daysPerMonth = 32
// const toDay = position === "next" ? daysPerMonth : 1
// const toMonth = position === "next" ? monthsPerYear : 0
// switch (currentConfig.viewType) {
// case "month":
// fromDate = {
// day: toDay,
// month: currentDate.currentMonth,
// year: currentDate.currentYear
// }
// break
// case "year":
// fromDate = {
// day: toDay,
// month: toMonth,
// year: currentDate.currentYear
// }
// break
// case "decade":
// fromDate = {
// day: toDay,
// month: currentDate.currentMonth,
// year: currentDate.currentYear
// }
// break
// case "century":
// default:
// fromDate = {
// day: toDay,
// month: currentDate.currentMonth,
// year: currentDate.currentYear
// }
// break
// }
// try {
// const { targetDate } = getRelativeEventFromDate(fromDate, position)
// jumpToDate(targetDate)
// } catch (err) {
// toast({
// title: t("entity.calendar.event.outOfBoundsTitle"),
// variant: "default",
// description: t("entity.calendar.event.outOfBoundsMessage"),
// duration: 4000,
// })
// }
// }
</script>
<template>
<div class="flex gap-2">
<div class="grid items-end w-40 px-4 py-2 border-slate-200 bg-white dark:bg-black dark:border-slate-700 border-x-[1px] border-t-[1px] rounded-t-sm text-sm transition-colors">
<ClientOnly>
<span>{{ currentDate.currentDateTitle }}</span>
<template #fallback>
<span class="inline-block">
<UiSkeleton class="h-[19px] w-full rounded-sm" />
</span>
</template>
</ClientOnly>
</div>
<!-- <div>
<UiTooltipProvider :delay-duration="250">
<UiTooltip>
<UiTooltipTrigger as-child>
<UiButton
variant="outline"
size="icon"
class="rounded-t-sm rounded-b-none border-b-0"
@click="handleGotoPreviousEventPage('prev')"
>
<PhArrowLineLeft size="22" />
</UiButton>
</UiTooltipTrigger>
<UiTooltipContent>
<p>
{{ $t('entity.calendar.event.prevPage') }}
</p>
</UiTooltipContent>
</UiTooltip>
</UiTooltipProvider>
</div>
<div>
<UiTooltipProvider :delay-duration="250">
<UiTooltip>
<UiTooltipTrigger as-child>
<UiButton
variant="outline"
size="icon"
class="rounded-t-sm rounded-b-none border-b-0"
@click="handleGotoPreviousEventPage('next')"
>
<PhArrowLineRight size="22" />
</UiButton>
</UiTooltipTrigger>
<UiTooltipContent>
<p>
{{ $t('entity.calendar.event.nextPage') }}
</p>
</UiTooltipContent>
</UiTooltip>
</UiTooltipProvider>
</div> -->
</div>
</template>

View File

@@ -1,34 +0,0 @@
<script setup lang="ts">
import { useCalendar } from "@/stores/CalendarStore"
import { PhCalendarBlank } from "@phosphor-icons/vue"
import { computed } from "vue"
const { currentConfig, viewTypeOptions, getViewTypeTitle, setViewType } = useCalendar()
const viewTypeTitle = computed(() => getViewTypeTitle(currentConfig.viewType))
</script>
<template>
<UiDropdownMenu>
<UiDropdownMenuTrigger as-child>
<UiButton size="sm" variant="secondary">
<PhCalendarBlank size="18" weight="fill" />
{{ viewTypeTitle }}
</UiButton>
</UiDropdownMenuTrigger>
<UiDropdownMenuContent :side="'bottom'" :collision-padding="30">
<UiDropdownMenuLabel>
{{ $t('ui.displayMode') }}
</UiDropdownMenuLabel>
<UiDropdownMenuSeparator />
<UiDropdownMenuItem
v-for="option in viewTypeOptions"
:key="option"
@click="setViewType(option)"
>
{{ getViewTypeTitle(option) }}
</UiDropdownMenuItem>
</UiDropdownMenuContent>
</UiDropdownMenu>
</template>

View File

@@ -0,0 +1,25 @@
<script lang="ts" setup>
import { PhTag } from "@phosphor-icons/vue"
const { toggleCategoriesModal } = useCalendar()
const { isReadOnly } = storeToRefs(useCalendar())
</script>
<template>
<UiTooltipProvider :delay-duration="250">
<UiTooltip>
<UiTooltipTrigger as-child>
<ClientOnly>
<UiButton v-if="!isReadOnly" variant="secondary" size="icon" @click="toggleCategoriesModal(true)">
<PhTag size="20" weight="light" />
</UiButton>
</ClientOnly>
</UiTooltipTrigger>
<UiTooltipContent>
<p>
{{ $t('entity.calendar.seeCategories') }}
</p>
</UiTooltipContent>
</UiTooltip>
</UiTooltipProvider>
</template>

View File

@@ -0,0 +1,45 @@
<script lang="ts" setup>
import { storeToRefs } from "pinia"
import { computed } from "vue"
import { PhMapPin } from "@phosphor-icons/vue"
import { breakpointsTailwind } from "@vueuse/core"
const { defaultDate, getFormattedDateTitle, getRelativeString, getDifferenceInDays } = useCalendar()
const { selectedDate } = storeToRefs(useCalendar())
const breakpoints = useBreakpoints(
breakpointsTailwind
)
const mainDateTitle = computed(() => getFormattedDateTitle(selectedDate.value, true))
// const mainDateTitle = computed(() => convertDateToDays(selectedDate.value))
const dateDifference = computed(() => getRelativeString(defaultDate, selectedDate.value))
const isToday = computed(() => getDifferenceInDays(defaultDate, selectedDate.value) === 0)
</script>
<template>
<ClientOnly>
<div class="grid md:flex md:gap-2 items-center">
<h1 class="text-lg md:text-2xl max-md:leading-tight font-bold flex items-center gap-1">
<PhMapPin
:size="breakpoints.md.value ? 26 : 18"
class="max-md:hidden"
weight="light"
/>
{{ mainDateTitle }}
</h1>
<h2 v-if="!isToday" class="text-sm max-md:leading-tight md:text-xl italic opacity-75">
<span class="max-md:hidden"></span> {{ dateDifference }}
</h2>
</div>
<template #fallback>
<div class="flex items-center gap-1">
<UiSkeleton class="h-8 w-64 max-md:max-w-full" />
<UiSkeleton class="max-md:hidden h-6 w-28" />
</div>
</template>
</ClientOnly>
</template>

View File

@@ -0,0 +1,68 @@
<script setup lang="ts">
import { breakpointsTailwind } from "@vueuse/core"
import { cn } from "~/lib/utils"
import { useCalendar } from "~/stores/CalendarStore"
import { PhCalendarBlank, PhCheckCircle, PhDotsThreeVertical, PhGear, PhTag } from "@phosphor-icons/vue"
const breakpoints = useBreakpoints(
breakpointsTailwind
)
const { currentConfig, viewTypeOptions, getViewTypeTitle, setViewType, toggleCategoriesModal } = useCalendar()
const viewTypeTitle = computed(() => getViewTypeTitle(currentConfig.viewType))
</script>
<template>
<UiDropdownMenu>
<UiDropdownMenuTrigger as-child>
<UiButton variant="secondary" size="icon">
<ClientOnly>
<PhGear v-if="breakpoints.md.value" size="20" weight="fill" />
<PhDotsThreeVertical v-else size="26" weight="bold" />
</ClientOnly>
</UiButton>
</UiDropdownMenuTrigger>
<UiDropdownMenuContent :side="'bottom'" :align="'start'" :side-offset="10" :align-offset="25" :collision-padding="20" class="text-right">
<UiDropdownMenuArrow />
<UiDropdownMenuLabel>
{{ $t('entity.calendar.seeOptions') }}
</UiDropdownMenuLabel>
<UiDropdownMenuItem
v-if="!breakpoints.md.value"
class="flex gap-[1ch] justify-end items-center"
@click="toggleCategoriesModal(true)"
>
{{ $t('entity.calendar.seeCategories') }}
<PhTag size="18" />
</UiDropdownMenuItem>
<UiDropdownMenuSub>
<UiDropdownMenuSubTrigger arrow-direction="left" class="p-0 rounded-none">
<UiDropdownMenuItem class="flex gap-[1ch] justify-end items-center pointer-events-none">
{{ $t('ui.displayMode') }}
<PhCalendarBlank size="18" weight="fill" />
</UiDropdownMenuItem>
</UiDropdownMenuSubTrigger>
<UiDropdownMenuPortal>
<UiDropdownMenuSubContent>
<UiDropdownMenuItem
v-for="option in viewTypeOptions"
:key="option"
class="flex gap-[.5ch] items-center rounded-none transition-colors"
:class="cn({ 'text-emerald-600': viewTypeTitle === getViewTypeTitle(option) })"
@click="setViewType(option)"
>
<PhCheckCircle v-if="viewTypeTitle === getViewTypeTitle(option)" size="20" weight="fill" />
{{ getViewTypeTitle(option) }}
</UiDropdownMenuItem>
</UiDropdownMenuSubContent>
</UiDropdownMenuPortal>
</UiDropdownMenuSub>
</UiDropdownMenuContent>
</UiDropdownMenu>
</template>

View File

@@ -0,0 +1,103 @@
<script lang="ts" setup>
import { cn } from "~/lib/utils"
import { PhArchive, PhCalendarDots, PhFile, PhFileDashed, PhFilePlus, PhPencil, PhPencilSimpleLine, PhTrash } from "@phosphor-icons/vue"
import { DateTime } from "luxon"
import type { Calendar } from "~/models/CalendarConfig"
const props = defineProps<{
calendar: Calendar
gmId?: string
showActions?: boolean
}>()
const emit = defineEmits(["on-edit", "on-delete"])
const cardRef = ref(null)
const isCardHovered = useElementHover(cardRef)
const { focused: isCardFocused } = useFocusWithin(cardRef)
const { locale } = useI18n()
const createdAt = DateTime.fromISO(props.calendar.createdAt!).toLocaleString(DateTime.DATETIME_MED, { locale: locale.value })
const updatedAt = computed<string>(() => props.calendar.updatedAt ? DateTime.fromISO(props.calendar.updatedAt).toLocaleString(DateTime.DATETIME_MED, { locale: locale.value }) : "")
const user = useSupabaseUser()
const isOwner = computed(() => user.value && props.gmId && user.value.id === props.gmId)
const calendarLink = computed(() => isOwner.value ? `/my/calendars/${props.calendar.id}` : `/calendars/${props.calendar.shortId}`)
const hasActions = computed(() => isOwner.value && props.showActions)
</script>
<template>
<UiCard
ref="cardRef"
class="w-full h-full flex flex-col"
:link="calendarLink"
:class="cn(
calendar.color ? `group card-color element-${calendar.color}` : '',
)"
>
<UiCardHeader class="gap-4">
<UiCardTitle
class="text-xl"
:class="cn({
'pr-18': hasActions
})"
>
{{ calendar.name }}
</UiCardTitle>
<div v-if="calendar.state === 'published'" class="flex items-center gap-1 text-sm">
<PhFile size="20" weight="fill" />
<span>{{ $t('ui.contentState.published') }}</span>
</div>
<div v-if="calendar.state === 'draft'" class="flex items-center gap-1 text-sm">
<PhFileDashed size="20" weight="fill" />
<span>{{ $t('ui.contentState.draft') }}</span>
</div>
<div v-if="calendar.state === 'archived'" class="flex items-center gap-1 text-sm">
<PhArchive size="20" weight="fill" />
<span>{{ $t('ui.contentState.archived') }}</span>
</div>
</UiCardHeader>
<UiCardContent class="grow">
<p class="flex items-center gap-1">
<PhCalendarDots size="24" weight="fill" />
<span v-if="calendar.eventNb?.[0].count! > 1">{{ $t("entity.calendar.hasXEvents", { count: calendar.eventNb?.[0].count }) }}</span>
<span v-else>{{ $t("entity.calendar.hasXEvent", { count: calendar.eventNb?.[0].count }) }}</span>
</p>
<div
v-if="hasActions && (isCardHovered || isCardFocused)"
class="flex gap-2 absolute top-4 right-4 z-20"
>
<Transition name="fade" appear>
<UiButton size="icon" variant="outline" class="size-8 border-foreground/20 group-hover:border-foreground/30 hover:text-background hover:border-foreground hover:bg-foreground" @click="emit('on-edit')">
<PhPencil size="15" weight="fill" />
</UiButton>
</Transition>
<Transition name="fade" appear>
<UiButton size="icon" variant="outline" class="size-8 border-foreground/25 group-hover:border-foreground/40 hover:text-background hover:border-rose-500 hover:bg-rose-500" @click="emit('on-delete')">
<PhTrash size="15" weight="fill" />
</UiButton>
</Transition>
</div>
</UiCardContent>
<hr>
<UiCardFooter class="border-t-0">
<ul class="grid gap-1 text-sm">
<li class="flex gap-1 items-center">
<PhFilePlus size="18" />
<span>{{ $t('common.createdAt', { createdAt }) }}</span>
</li>
<li v-if="updatedAt" class="flex gap-1 items-center">
<PhPencilSimpleLine size="18" />
<span>{{ $t('common.updatedAt', { updatedAt }) }}</span>
</li>
</ul>
</UiCardFooter>
</UiCard>
</template>

View File

@@ -0,0 +1,28 @@
<script lang="ts" setup>
import { breakpointsTailwind, useBreakpoints } from "@vueuse/core"
import { PhMagnifyingGlass } from "@phosphor-icons/vue"
const { revealAdvancedSearch } = useCalendar()
const breakpoints = useBreakpoints(
breakpointsTailwind
)
</script>
<template>
<ClientOnly>
<Transition name="fade" appear>
<UiButton
:search-slash="breakpoints.lg.value"
:size="breakpoints.lg.value ? 'default' : 'icon'"
@click="revealAdvancedSearch()"
>
<PhMagnifyingGlass size="20" weight="light" />
<span v-if="breakpoints.lg.value">
{{ $t('entity.advancedSearch.title') }}
</span>
</UiButton>
</Transition>
</ClientOnly>
</template>

View File

@@ -0,0 +1,15 @@
<script setup lang="ts">
import type { Category } from "~/models/Category";
defineProps<{
categories: Category[]
}>()
</script>
<template>
<ul>
<li v-for="category in categories" :key="category.id">
<CalendarCategoryListItem :category="category" />
</li>
</ul>
</template>

View File

@@ -0,0 +1,15 @@
<script setup lang="ts">
import type { Category } from "~/models/Category";
defineProps<{
category: Category
}>()
</script>
<template>
<div class="flex items-center gap-2">
<span class="text-sm text-gray-700 dark:text-gray-300">
{{ category.name }}
</span>
</div>
</template>

View File

@@ -0,0 +1,70 @@
<script setup lang="ts">
import type { Category } from "~/models/Category";
import { ScrollAreaRoot, ScrollAreaViewport, ScrollAreaScrollbar, ScrollAreaThumb } from "radix-vue"
const { categories } = defineProps<{
categories: Category[]
}>()
const sortedCategories = computed(() => categories.toSorted((a, b) => a.name.localeCompare(b.name)))
const deleteDialogOpened = ref<boolean>(false)
function openDeleteDialog() {
deleteDialogOpened.value = true
}
function closeDeleteDialog() {
deleteDialogOpened.value = false
}
</script>
<template>
<div class="flex flex-col h-full">
<CalendarCategoryTableHeader />
<ScrollAreaRoot class="h-36 grow overflow-hidden ">
<ScrollAreaViewport class="w-full h-full pr-4" as-child>
<div class="last:border-0">
<CalendarCategoryTableRow
v-for="item in sortedCategories"
:key="item.id"
:category="item"
@on-delete-category="openDeleteDialog"
/>
</div>
</ScrollAreaViewport>
<ScrollAreaScrollbar
class="flex select-none touch-none p-0.5 bg-background transition-colors duration-100 ease-out hover:bg-foreground/5 data-[orientation=vertical]:w-2.5 data-[orientation=horizontal]:flex-col data-[orientation=horizontal]:h-2.5"
orientation="vertical"
>
<ScrollAreaThumb
class="flex-1 bg-foreground/20 rounded-[10px] relative before:content-[''] before:absolute before:top-1/2 before:left-1/2 before:-translate-x-1/2 before:-translate-y-1/2 before:w-full before:h-full"
/>
</ScrollAreaScrollbar>
</ScrollAreaRoot>
<CalendarCategoryTableFooter />
</div>
<UiDialog v-model:open="deleteDialogOpened">
<UiDialogContent
:disable-outside-pointer-events="true"
:trap-focus="true"
class="min-w-96 border-indigo-200 dark:bg-slate-950 dark:border-indigo-950"
@escape-key-down="closeDeleteDialog"
@focus-outside="closeDeleteDialog"
@interact-outside="closeDeleteDialog"
@pointer-down-outside="closeDeleteDialog"
>
<UiDialogTitle>
{{ $t('entity.category.deleteDialog.title') }}
</UiDialogTitle>
<UiDialogDescription>
{{ $t('entity.category.deleteDialog.subtitle') }}
</UiDialogDescription>
<CalendarFormDeleteCategory />
</UiDialogContent>
</UiDialog>
</template>

View File

@@ -0,0 +1,130 @@
<script lang="ts" setup>
import { PhPlus } from "@phosphor-icons/vue"
import { useToast } from "~/components/ui/toast"
import { ToastLifetime } from "~/components/ui/toast/use-toast"
import { cn } from "~/lib/utils"
const { toast } = useToast()
const { t } = useI18n()
type FooterMode = "add" | "view"
const currentMode = ref<FooterMode>("view")
const rowRef = ref<HTMLDivElement | null>(null)
const inputRef = ref<HTMLInputElement | null>(null)
const { focused: inputFocused } = useFocus(inputRef)
/**
* Toggle view mode options
*/
type ToggleViewOptions = {
execution?: "now" | "nextTick"
}
/**
* Toggle view mode
* @param options.execution - When to execute the toggle. "now" or "nextTick"
*/
function toggleView(options: ToggleViewOptions = { execution: "now" }) {
currentMode.value = "view"
if (options.execution === "now") {
inputFocused.value = false
} else {
nextTick(() => {
inputFocused.value = false
})
}
}
/**
* Toggle add mode
*/
function toggleAdd() {
currentMode.value = "add"
categorySkeleton.value = { name: "", color: "black" }
nextTick(() => {
inputFocused.value = true
})
}
onClickOutside(rowRef, () => toggleView({ execution: "nextTick" }))
onKeyStroke("Escape", () => toggleView({ execution: "now" }))
const { addCategoryFromSkeleton } = useCategoryStore()
const { categorySkeleton } = storeToRefs(useCategoryStore())
/**
* Submit the update
*/
async function submitNew() {
if (!categorySkeleton.value) return
const newCategoryName = toRaw(categorySkeleton.value).name
const { error } = await tryCatch(addCategoryFromSkeleton())
if (error) {
toast({
title: t("entity.category.addedToast.titleError", { category: newCategoryName }),
variant: "destructive",
duration: ToastLifetime.LONG
})
return
}
toggleView({ execution: "now" })
toast({
title: t("entity.category.addedToast.title", { category: newCategoryName }),
variant: "success",
duration: ToastLifetime.SHORT
})
}
</script>
<template>
<div class="border-y-[1px] border-b-foreground/10 mr-4">
<form
ref="rowRef"
class="grid grid-cols-12 items-center gap-4 p-1 bg-transparent hover:bg-slate-50 dark:bg-transparent dark:hover:bg-slate-900"
@submit.prevent="submitNew"
>
<div v-if="currentMode === 'add'" class="col-span-1" />
<div
:class="cn({
'col-span-6': currentMode === 'view',
'col-span-5': currentMode === 'add'
})"
>
<template v-if="currentMode === 'view'">
<button
class="p-2 h-full w-full text-left underline-offset-4 hover:underline cursor-pointer"
@click="toggleAdd"
>
<PhPlus size="18" />
</button>
</template>
<template v-if="currentMode === 'add' && categorySkeleton">
<input
ref="inputRef"
v-model="categorySkeleton.name"
type="text"
class="p-1 h-full w-full bg-transparent focus-visible:outline-hidden italic"
>
</template>
</div>
<div class="col-span-4">
<template v-if="currentMode === 'add' && categorySkeleton">
<div class="-mx-2">
<InputColor
id="category-color"
v-model="categorySkeleton.color"
position="item-aligned"
theme="subtle"
/>
</div>
</template>
</div>
</form>
</div>
</template>

View File

@@ -0,0 +1,19 @@
<script setup lang="ts">
import { PhListBullets } from "@phosphor-icons/vue";
</script>
<template>
<header class="grid grid-cols-12 gap-4 px-2 py-4 border-b-[1px] border-b-border font-bold mr-4">
<div class="col-span-1 flex items-end">
<PhListBullets size="20" />
</div>
<div class="col-span-5">
Nom
</div>
<div class="col-span-4">
Couleur
</div>
<div class="col-span-2" />
</header>
</template>

View File

@@ -0,0 +1,187 @@
<script setup lang="ts">
import { PhCheck, PhTrash } from "@phosphor-icons/vue"
import { useToast } from "~/components/ui/toast"
import { ToastLifetime } from "~/components/ui/toast/use-toast"
import { cn } from "~/lib/utils"
import type { Category } from "~/models/Category"
const { toast } = useToast()
const { t } = useI18n()
const { category } = defineProps<{
category: Category
}>()
const emit = defineEmits<{
(e: "on-delete-category", payload: Category): void
}>()
type RowMode = "edit" | "view"
const currentMode = ref<RowMode>("view")
const rowRef = ref<HTMLDivElement | null>(null)
const inputRef = ref<HTMLInputElement | null>(null)
const { focused: inputFocused } = useFocus(inputRef)
const rowHovered = useElementHover(rowRef)
/**
* Toggle view mode options
*/
type ToggleViewOptions = {
execution?: "now" | "nextTick"
}
/**
* Toggle view mode
* @param options.execution - When to execute the toggle. "now" or "nextTick"
*/
function toggleView(options: ToggleViewOptions = { execution: "now" }) {
currentMode.value = "view"
if (options.execution === "now") {
inputFocused.value = false
} else {
nextTick(() => {
inputFocused.value = false
})
}
}
/**
* Toggle edit mode
*/
function toggleEdit() {
currentMode.value = "edit"
categorySkeleton.value = structuredClone(toRaw(category))
nextTick(() => {
inputFocused.value = true
})
}
onClickOutside(rowRef, () => toggleView({ execution: "nextTick" }))
onKeyStroke("Escape", () => toggleView({ execution: "now" }))
const { resetSkeleton, updateCategoryFromSkeleton } = useCategoryStore()
const { categorySkeleton } = storeToRefs(useCategoryStore())
onUnmounted(() => {
resetSkeleton()
})
/**
* Submit the update
*/
async function submitUpdate() {
const { error } = await tryCatch(updateCategoryFromSkeleton())
if (error) {
toast({
title: t("entity.category.updatedToast.titleError", { category: category.name }),
variant: "destructive",
duration: ToastLifetime.LONG
})
return
}
toggleView({ execution: "now" })
toast({
title: t("entity.category.updatedToast.title", { category: category.name }),
variant: "success",
duration: ToastLifetime.SHORT
})
}
function handleQueryDelete() {
categorySkeleton.value = structuredClone(toRaw(category))
emit("on-delete-category", category)
}
</script>
<template>
<div ref="rowRef" class="relative">
<form
class="grid grid-cols-12 items-center gap-4 p-1 border-b-[1px] border-b-foreground/10"
:class="cn(
{ 'bg-slate-100 hover:bg-slate-200 dark:bg-slate-900 dark:hover:bg-slate-800': currentMode === 'edit' },
{ 'bg-transparent hover:bg-slate-50 dark:bg-transparent dark:hover:bg-slate-900': currentMode !== 'edit' }
)"
@submit.prevent="submitUpdate"
>
<div class="col-span-1 pointer-events-none">
<span class="opacity-50 p-2">{{ category.id }}</span>
</div>
<div
class="col-span-5"
>
<template v-if="currentMode === 'view'">
<button
class="py-2 px-1 h-full w-full text-left underline-offset-4 hover:underline cursor-pointer"
@click="toggleEdit"
>
{{ category.name }}
</button>
</template>
<template v-else-if="currentMode === 'edit' && categorySkeleton">
<input
ref="inputRef"
v-model="categorySkeleton.name"
type="text"
class="p-1 h-full w-full bg-transparent focus-visible:outline-hidden italic"
>
</template>
</div>
<div class="col-span-4">
<template v-if="currentMode === 'view'">
<button
class="p-1 h-full w-full text-left text-sm cursor-pointer"
@click="toggleEdit"
>
<span
class="bgc"
:class="cn(`element-${category.color}`)"
>
{{ $t(`ui.colors.${category.color}`) }}
</span>
</button>
</template>
<template v-else-if="currentMode === 'edit' && categorySkeleton">
<div class="-mx-2">
<InputColor
id="category-color"
v-model="categorySkeleton.color"
position="item-aligned"
theme="subtle"
/>
</div>
</template>
</div>
</form>
<menu class="w-fit absolute top-1/2 -translate-y-1/2 right-2 flex items-center gap-2">
<li
v-if="currentMode === 'edit' && categorySkeleton"
>
<UiButton
variant="secondary"
size="icon"
class="w-6 h-6 rounded-full bg-emerald-500 hover:bg-emerald-600 text-white"
:title="$t('ui.actions.edit')"
@click="submitUpdate"
>
<PhCheck size="14" weight="bold" />
</UiButton>
</li>
<li v-else-if="rowHovered">
<UiButton
variant="secondary"
size="icon"
class="w-6 h-6 rounded-full hover:bg-red-600 hover:text-white"
:title="$t('ui.actions.delete')"
@click="handleQueryDelete"
>
<PhTrash size="14" weight="bold" />
</UiButton>
</li>
</menu>
</div>
</template>

View File

@@ -0,0 +1,41 @@
<script lang="ts" setup>
import { PhX } from "@phosphor-icons/vue";
const { toggleCategoriesModal } = useCalendar()
const { categories, isCategoriesModalOpen } = storeToRefs(useCalendar())
function handleClosing() {
toggleCategoriesModal(false)
}
</script>
<template>
<UiAlertDialog :open="isCategoriesModalOpen">
<UiAlertDialogContent
class="grid grid-rows-[auto_1fr_auto] items-start min-h-[66vh] max-w-4xl"
:disable-outside-pointer-events="true"
:trap-focus="true"
@focus-outside="handleClosing"
@interact-outside="handleClosing"
@close-auto-focus="(e) => e.preventDefault()"
>
<header>
<UiAlertDialogTitle>
<span class="text-2xl">
{{ $t('entity.category.manageDialog.title') }}
</span>
</UiAlertDialogTitle>
<UiAlertDialogDescription>
{{ $t('entity.category.manageDialog.subtitle') }}
</UiAlertDialogDescription>
</header>
<UiButton size="icon" variant="ghost" class="absolute top-4 right-4" title="Fermer la fenêtre" @click="handleClosing">
<PhX size="20" />
</UiButton>
<CalendarCategoryTable :categories />
</UiAlertDialogContent>
</UiAlertDialog>
</template>

View File

@@ -17,12 +17,13 @@ const emit = defineEmits(["on-close"])
function handleClose() {
emit("on-close")
setTimeout(() => calendarSkeletonName.value = "", 100)
}
</script>
<template>
<UiAlertDialog :open="modalState">
<UiAlertDialogContent class="grid grid-rows-[auto_1fr_auto] items-start min-h-[66vh] max-w-4xl gap-6">
<UiAlertDialogContent class="grid grid-rows-[auto_1fr_auto] items-start min-h-[66vh] max-w-4xl gap-6" @close-auto-focus="(e) => e.preventDefault()">
<UiAlertDialogTitle>
<span class="text-2xl">
<strong class="font-bold">{{ world.name }}</strong>
@@ -40,7 +41,7 @@ function handleClose() {
<PhX size="20" />
</UiButton>
<CalendarFormCreate @on-changed-name="onChangedName" @on-close="handleClose" />
<CalendarFormCreate v-if="world.id" :world-id="world.id" @on-changed-name="onChangedName" @on-close="handleClose" />
</UiAlertDialogContent>
</UiAlertDialog>
</template>

View File

@@ -1,7 +1,7 @@
<script lang="ts" setup>
import type { RPGDate } from "~/models/Date";
const { eventSkeleton, operationInProgress } = storeToRefs(useCalendar())
const { eventSkeleton, operationInProgress, currentRPGDate } = storeToRefs(useCalendar())
const { resetSkeleton } = useCalendar()
const popoverOpen = ref(false)
@@ -35,10 +35,17 @@ function openEventCreatePopover() {
*
* @param e The closing event (can be keydown or click)
*/
function handleClosing(e: Event) {
e.preventDefault()
function handleClosing() {
popoverOpen.value = false
resetSkeleton()
}
// If the date changes, the popover should close
// Only for months for now (because it's the only view)
watch(currentRPGDate, () => {
if (!popoverOpen.value) return
handleClosing()
})
</script>
<template>
@@ -53,8 +60,8 @@ function handleClosing(e: Event) {
:disable-outside-pointer-events="true"
:trap-focus="true"
class="pl-3 w-[30rem] max-w-full border-indigo-200 dark:bg-slate-950 dark:border-indigo-950"
@escape-key-down="handleClosing"
@pointer-down-outside="handleClosing"
@escape-key-down.prevent="handleClosing"
@pointer-down-outside.prevent="handleClosing"
>
<CalendarFormCreateEvent @event-created="handleClosing" />
</UiPopoverContent>

View File

@@ -1,6 +1,7 @@
<script lang="ts" setup>
import { PhCircleNotch } from "@phosphor-icons/vue";
import { useToast } from "~/components/ui/toast";
import { ToastLifetime } from "~/components/ui/toast/use-toast";
import type { Calendar } from "~/models/CalendarConfig";
const { toast } = useToast()
@@ -21,26 +22,25 @@ async function handleAction(): Promise<void> {
isLoading.value = true
try {
await $fetch(`/api/calendars/${props.calendar.id}`, { method: "DELETE" })
emit("on-close")
const { error } = await tryCatch($fetch(`/api/calendars/${props.calendar.id}`, { method: "DELETE" }))
if (error) {
toast({
title: error.message,
variant: "destructive"
})
isLoading.value = false
return
}
toast({
title: t("entity.calendar.deletedToast.title", { calendar: props.calendar.name }),
variant: "success",
duration: 3000
duration: ToastLifetime.SHORT
})
} catch (err) {
console.log(err)
if (err instanceof Error) {
toast({
title: err.message,
variant: "destructive"
})
}
} finally {
emit("on-close")
isLoading.value = false
}
}
/**
@@ -65,6 +65,7 @@ function handleClosing() {
@focus-outside="handleClosing"
@interact-outside="handleClosing"
@pointer-down-outside="handleClosing"
@close-auto-focus="(e) => e.preventDefault()"
>
<UiAlertDialogTitle>
{{ $t('entity.calendar.deleteDialog.title') }}

View File

@@ -6,7 +6,7 @@ const isLoading = ref<boolean>(false)
// Watch the popover state
watch(isDeleteEventModalOpen, (hasOpened, _o) => {
if (hasOpened && lastActiveEvent.value) {
eventSkeleton.value = { ...lastActiveEvent.value }
eventSkeleton.value = structuredClone(toRaw(lastActiveEvent.value))
}
})

View File

@@ -1,28 +1,62 @@
<script setup lang="ts">
import { breakpointsTailwind, useBreakpoints } from "@vueuse/core"
import { PhPlus } from "@phosphor-icons/vue";
import { VisuallyHidden } from "radix-vue";
const isDialogOpen = ref<boolean>(false);
const { resetSkeleton } = useCalendar();
// Toggles the dialog
function toggleDialog() {
isDialogOpen.value = !isDialogOpen.value;
};
/**
* Prevents the modal from closing if's still loading
*/
function handleClosing() {
setTimeout(() => resetSkeleton(), 100)
}
const breakpoints = useBreakpoints(
breakpointsTailwind
)
</script>
<template>
<UiButton @click="toggleDialog">
<PhPlus size="18" weight="bold" />
<ClientOnly>
<Transition name="fade" appear>
<UiButton
class="max-md:fixed max-md:bottom-8 max-md:right-8 max-md:z-50 max-md:size-14 max-md:rounded-xl"
:size="breakpoints.md.value ? 'default' : 'icon'"
@click="toggleDialog"
>
<PhPlus :size="breakpoints.md.value ? 18 : 24" weight="bold" />
<strong class="font-semibold">
<strong v-if="breakpoints.md.value" class="font-semibold">
{{ $t("entity.calendar.event.newEvent") }}
</strong>
</UiButton>
</Transition>
</ClientOnly>
<UiDialog v-model:open="isDialogOpen">
<UiDialogContent class="border-indigo-200 dark:bg-slate-950 dark:border-indigo-950">
<UiDialogTitle>
<UiDialogContent
class="max-md:translate-0 max-md:inset-0 max-md:w-full max-md:block"
:trap-focus="true"
@escape-key-down="handleClosing"
@pointer-down-outside.prevent="handleClosing"
>
<UiDialogTitle class="max-md:mb-8">
{{ $t("entity.calendar.event.addSingle") }}
</UiDialogTitle>
<VisuallyHidden>
<UiDialogDescription>
{{ $t("entity.calendar.event.addSingleDescription") }}
</UiDialogDescription>
</VisuallyHidden>
<CalendarFormCreateEvent @event-created="toggleDialog" />
</UiDialogContent>
</UiDialog>

View File

@@ -0,0 +1,49 @@
<script lang="ts" setup>
import { PhX } from "@phosphor-icons/vue";
import type { Calendar } from "~/models/CalendarConfig";
import type { World } from "~/models/World";
const props = defineProps<{
calendar: Calendar | null,
world: World | null,
modalState?: boolean
}>()
const calendarSkeletonName = ref<string>(props.calendar?.name ?? "")
function onChangedName(newName: string) {
calendarSkeletonName.value = newName
}
const emit = defineEmits(["on-close"])
function handleClose() {
emit("on-close")
setTimeout(() => calendarSkeletonName.value = "", 100)
}
</script>
<template>
<UiAlertDialog :open="modalState">
<UiAlertDialogContent class="grid grid-rows-[auto_1fr_auto] items-start min-h-[66vh] max-w-4xl gap-6" @close-auto-focus="(e) => e.preventDefault()">
<UiAlertDialogTitle>
<span class="text-2xl">
<strong class="font-bold">{{ world?.name }}</strong>
<span class="opacity-30"> — </span>
<span v-if="calendarSkeletonName">
{{ calendarSkeletonName }}
</span>
<span v-else>
{{ $t('entity.calendar.updateDialog.title') }}
</span>
</span>
</UiAlertDialogTitle>
<UiButton size="icon" variant="ghost" class="absolute top-4 right-4" title="Fermer la fenêtre" @click="handleClose">
<PhX size="20" />
</UiButton>
<CalendarFormUpdate v-if="calendar" :world="world" :calendar="calendar" @on-changed-name="onChangedName" @on-close="handleClose" />
</UiAlertDialogContent>
</UiAlertDialog>
</template>

View File

@@ -1,10 +1,11 @@
<script lang="ts" setup>
const { eventSkeleton, lastActiveEvent, isEditEventModalOpen } = storeToRefs(useCalendar())
const { resetSkeleton } = useCalendar();
// Watch the popover state
watch(isEditEventModalOpen, (hasOpened, _o) => {
if (hasOpened && lastActiveEvent.value) {
eventSkeleton.value = { ...lastActiveEvent.value }
eventSkeleton.value = structuredClone(toRaw(lastActiveEvent.value))
}
})
@@ -15,6 +16,7 @@ watch(isEditEventModalOpen, (hasOpened, _o) => {
*/
function handleClosing() {
isEditEventModalOpen.value = false
setTimeout(() => resetSkeleton(), 100)
}
</script>
@@ -23,13 +25,13 @@ function handleClosing() {
<UiDialogContent
:disable-outside-pointer-events="true"
:trap-focus="true"
class="pl-3 min-w-96 border-indigo-200 dark:bg-slate-950 dark:border-indigo-950"
class="pl-3 md:min-w-96 max-md:translate-0 max-md:inset-0 max-md:w-full max-md:block"
@escape-key-down="handleClosing"
@focus-outside="handleClosing"
@interact-outside="handleClosing"
@pointer-down-outside="(e) => e.preventDefault()"
>
<header class="pl-8 grid gap-y-2">
<header class="pl-8 grid gap-y-2 max-md:mb-8">
<UiDialogTitle>
{{ $t('entity.calendar.event.editDialog.title') }}
</UiDialogTitle>

View File

@@ -1,8 +1,9 @@
<script lang="ts" setup>
import { cn } from "@/lib/utils"
import type { RPGDate } from "@/models/Date"
import type { CalendarEvent } from "@/models/CalendarEvent"
import { useCalendar } from "@/stores/CalendarStore"
import { cn } from "~/lib/utils"
import type { RPGDate } from "~/models/Date"
import type { CalendarEvent } from "~/models/CalendarEvent"
import { useCalendar } from "~/stores/CalendarStore"
import { breakpointsTailwind, useBreakpoints } from "@vueuse/core"
import {
PhHourglassMedium,
@@ -13,6 +14,7 @@ import {
PhDotsThreeOutlineVertical,
PhEye
} from "@phosphor-icons/vue"
import type { CollisionPadding } from "~/models/Popover"
const { defaultDate, getFormattedDateTitle, jumpToDate, getRelativeString, revealEditEventModal, revealDeleteEventModal } = useCalendar()
const { lastActiveEvent, isReadOnly } = storeToRefs(useCalendar())
@@ -24,6 +26,22 @@ const props = defineProps<{
isEndEvent?: boolean
}>()
const breakpoints = useBreakpoints(
breakpointsTailwind
)
const collisionPadLg: CollisionPadding = {
top: 50,
bottom: 50,
left: 50,
right: 50,
}
const collisionPad: CollisionPadding = {
top: 80,
bottom: 80,
left: 12.5,
right: 12.5,
}
// Ref for the popover
const eventDetails = ref<HTMLElement>()
@@ -43,7 +61,7 @@ function handleJumpToDate(date: RPGDate) {
const commandMenuOpened = ref(false)
function deployEditModal() {
lastActiveEvent.value = { ...props.event }
lastActiveEvent.value = structuredClone(toRaw(props.event))
revealEditEventModal()
commandMenuOpened.value = false
emit("query:close-popover")
@@ -53,7 +71,7 @@ function deployEditModal() {
* Confirm event deletion
*/
function deployDeleteModal() {
lastActiveEvent.value = { ...props.event }
lastActiveEvent.value = structuredClone(toRaw(props.event))
revealDeleteEventModal()
commandMenuOpened.value = false
emit("query:close-popover")
@@ -62,17 +80,14 @@ function deployDeleteModal() {
<template>
<UiPopoverContent
class="w-96"
class="max-w-full w-96 event-popover"
:align="'center'"
:align-offset="50"
:side="'left'"
:collision-padding="60"
:hide-when-detached="true"
:align-offset="breakpoints.lg.value ? 50 : 25"
:side-offset="8"
:side="breakpoints.lg.value ? 'left' : 'top'"
:collision-padding="breakpoints.lg.value ? collisionPadLg : collisionPad"
:class="cn(
event.category ? `event-details-${event.category.color}` : '',
{
'event-details': event.category
}
event.category ? `element-${event.category.color}` : '',
)"
@focus-outside.prevent
>
@@ -143,7 +158,7 @@ function deployDeleteModal() {
</template>
<template v-if="event.description">
<hr class="border-slate-500 mt-2" >
<hr class="border-border mt-2" >
<div class="max-h-48 overflow-y-auto mt-2 text-sm text-slate-600 dark:text-slate-300">
{{ event.description }}

View File

@@ -1,6 +1,6 @@
<script lang="ts" setup>
import { cn } from "@/lib/utils"
import type { RPGDate } from "@/models/Date"
import { cn } from "~/lib/utils"
import type { RPGDate } from "~/models/Date"
import type { CalendarEvent } from "~/models/CalendarEvent"
const props = defineProps<{
@@ -23,13 +23,13 @@ const isPopoverDetailsOpen = ref<boolean>(false)
function handleDoubleClick() {
isPopoverDetailsOpen.value = false
lastActiveEvent.value = { ...props.event }
lastActiveEvent.value = structuredClone(toRaw(props.event))
revealEditEventModal()
}
function handleDelete() {
isPopoverDetailsOpen.value = false
lastActiveEvent.value = { ...props.event }
lastActiveEvent.value = structuredClone(toRaw(props.event))
revealDeleteEventModal()
}
@@ -55,12 +55,12 @@ onMounted(() => {
<UiPopover v-model:open="isPopoverDetailsOpen">
<UiPopoverTrigger as-child>
<button
class="text-xs px-2 py-1 block w-full text-left rounded-sm focus-visible:bg-red-200"
class="event-button text-2xs md:text-xs px-[5px] py-[5px] md:px-2 md:py-1 block w-full text-left rounded-sm transition-colors outline-offset-1 cursor-pointer"
:class="
cn(
event.category ? `event-${event.category.color}` : '',
`element-${event.category?.color}`,
{
'italic': event.hidden,
'is-hidden': event.hidden,
'rounded-r-none': isStartEvent,
'rounded-l-none': isEndEvent,
}
@@ -75,7 +75,7 @@ onMounted(() => {
</button>
</UiPopoverTrigger>
<LazyCalendarEventDetails
<CalendarEventDetails
:event
:spans-multiple-days
:is-start-event

View File

@@ -2,7 +2,11 @@
import type { Calendar } from "~/models/CalendarConfig";
import { PhAlarm, PhCalendarDots, PhCircleNotch, PhWrench } from "@phosphor-icons/vue";
const defaultSkeleton: Calendar = { name: "", today: { day: 1, month: 0, year: 0 }, months: [], events: [], state: "draft" }
const props = defineProps<{
worldId: number
}>()
const defaultSkeleton: Calendar = { name: "", today: { day: 1, month: 0, year: 0 }, months: [], events: [], categories: [], state: "draft", color: "white" }
const calendarSkeleton = ref<Calendar>({ ...defaultSkeleton })
onMounted(() => {
@@ -38,16 +42,18 @@ const validSkeleton = computed(() => validSkeletonGeneral.value && validSkeleton
const isCreatingCalendar = ref<boolean>(false)
async function handleSubmit() {
try {
isCreatingCalendar.value = true
await $fetch("/api/calendars/create", { method: "POST", body: { ...calendarSkeleton.value, worldId: 1 } })
const { error } = await tryCatch($fetch("/api/calendars/create", { method: "POST", body: { ...calendarSkeleton.value, worldId: props.worldId } }))
if (error) {
console.log(error.message)
isCreatingCalendar.value = false
return
}
emit("on-close")
} catch (err) {
console.log(err)
} finally {
isCreatingCalendar.value = false
}
}
/**
@@ -79,25 +85,25 @@ function handleFormCancel() {
<div class="flex items-center gap-1">
<PhWrench size="18" weight="fill" />
{{ $t('entity.calendar.createDialog.tabs.general.title') }}
{{ $t('entity.calendar.actionDialog.tabs.general.title') }}
</div>
</UiTabsTrigger>
<UiTabsTrigger value="months" class="font-bold">
<div class="flex items-center gap-1">
<PhCalendarDots size="18" weight="fill" />
{{ $t('entity.calendar.createDialog.tabs.months.title') }}
{{ $t('entity.calendar.actionDialog.tabs.months.title') }}
</div>
</UiTabsTrigger>
<UiTabsTrigger value="today" class="font-bold">
<div class="flex items-center gap-1">
<PhAlarm size="18" weight="fill" />
{{ $t('entity.calendar.createDialog.tabs.today.title') }}
{{ $t('entity.calendar.actionDialog.tabs.today.title') }}
</div>
</UiTabsTrigger>
</UiTabsList>
<UiTabsContent value="global">
<UiTabsContent value="global" class="grid gap-4">
<input
id="new-calendar-name"
v-model="calendarSkeleton.name"
@@ -105,9 +111,25 @@ function handleFormCancel() {
name="new-calendar-name"
required
:placeholder="$t('common.title')"
class="w-full -my-1 py-2 -mx-1 px-1 text-xl border-b-[1px] bg-transparent focus-visible:outline-none focus-visible:border-blue-600"
class="w-full py-2 -mx-1 px-1 text-xl border-b-[1px] bg-transparent focus-visible:outline-hidden focus-visible:border-blue-600"
@input="handleNameChange"
>
<div class="-mx-1 px-1 grid gap-3">
<UiLabel for="new-calendar-state">
{{ $t('ui.contentState.label') }}
</UiLabel>
<InputContentState id="new-calendar-state" v-model="calendarSkeleton.state" />
</div>
<div class="-mx-1 grid gap-3">
<UiLabel for="new-calendar-color">
{{ $t('ui.colors.label') }}
</UiLabel>
<InputColor id="new-calendar-color" v-model="calendarSkeleton.color" />
</div>
</UiTabsContent>
<UiTabsContent value="months">
<CalendarInputMonthList v-model:model-value="calendarSkeleton.months" />

View File

@@ -2,12 +2,20 @@
import type { RPGDate } from "~/models/Date";
import { PhAlarm, PhCircleNotch, PhEye, PhEyeClosed, PhMapPinArea, PhTag } from "@phosphor-icons/vue"
const { t } = useI18n()
const emit = defineEmits(["event-created"])
const props = defineProps<{
date?: RPGDate
btnClass?: string
}>()
const { eventSkeleton } = storeToRefs(useCalendar())
const { submitSkeleton, cancelLatestRequest } = useCalendar()
const { t } = useI18n()
const newEventTitle = shallowRef<HTMLInputElement>()
useFocus(newEventTitle, { initialValue: true })
const isLoading = ref(false)
@@ -15,28 +23,22 @@ const formErrors = reactive<{ message: string | null }>({
message: null
})
const props = defineProps<{
date?: RPGDate
btnClass?: string
}>()
async function handleSubmit() {
// Prevent form submission if already loading
if (isLoading.value) return
isLoading.value = true
try {
await submitSkeleton()
const { error } = await tryCatch(submitSkeleton())
if (error) {
formErrors.message = error.message
isLoading.value = false
return
}
emit("event-created")
} catch (err) {
if (err instanceof Error) {
formErrors.message = err.message
}
} finally {
isLoading.value = false
}
}
/**
@@ -56,6 +58,7 @@ function handleCancel() {
<div class="col-span-2 pl-8">
<input
id="new-event-title"
ref="newEventTitle"
v-model="eventSkeleton.title"
type="text"
name="new-event-title"
@@ -63,7 +66,7 @@ function handleCancel() {
:placeholder="$t('entity.calendar.event.title')"
:maxlength="120"
pattern="([A-Za-zÀ-ÖØ-öø-ÿ0-9\s\&\-\~]+){3,120}"
class="w-full -my-1 py-1 -mx-1 px-1 text-lg border-b-[1px] bg-transparent focus-visible:outline-none focus-visible:border-blue-600 invalid:border-red-500"
class="w-full -my-1 py-1 -mx-1 px-1 text-lg border-b-[1px] bg-transparent focus-visible:outline-hidden focus-visible:border-blue-600 invalid:border-red-500"
>
<div class="mt-2 mb-1 text-xs opacity-50">
{{ t('entity.calendar.event.patterns.title') }}
@@ -77,7 +80,7 @@ function handleCancel() {
name="new-event-description"
:placeholder="$t('entity.addDescription')"
:maxlength="1200"
class="w-full -my-1 py-1 -mx-1 px-1 min-h-24 max-h-36 text-sm border-b-[1px] bg-transparent focus-visible:outline-none focus-visible:border-blue-600 invalid:border-red-500"
class="w-full -my-1 py-1 -mx-1 px-1 min-h-24 max-h-36 text-sm border-b-[1px] bg-transparent focus-visible:outline-hidden focus-visible:border-blue-600 invalid:border-red-500"
/>
<div class="mt-2 mb-1 text-xs opacity-50">
{{ t('entity.calendar.event.patterns.description') }}
@@ -137,7 +140,7 @@ function handleCancel() {
:placeholder="$t('entity.calendar.event.addLocation')"
:maxlength="160"
pattern="([A-Za-zÀ-ÖØ-öø-ÿ0-9\s\&\-\~]+){3,160}"
class="w-full -my-1 py-2 px-2 text-sm border-b-[1px] bg-transparent focus-visible:outline-none focus-visible:border-blue-600"
class="w-full -my-1 py-2 px-2 text-sm border-b-[1px] bg-transparent focus-visible:outline-hidden focus-visible:border-blue-600"
>
<div class="mt-2 mb-1 text-xs opacity-50">
{{ t('entity.calendar.event.patterns.location') }}

View File

@@ -0,0 +1,84 @@
<script lang="ts" setup>
import { PhCircleNotch } from "@phosphor-icons/vue";
import { useToast } from "~/components/ui/toast";
import { ToastLifetime } from "~/components/ui/toast/use-toast";
const { deleteCategoryFromSkeleton, cancelLatestRequest } = useCategoryStore()
const { isDeletingCategory, categorySkeleton } = storeToRefs(useCategoryStore())
const { toast } = useToast()
const { t } = useI18n()
const isLoading = ref<boolean>(false)
const formErrors = reactive<{ message: string | null }>({
message: null
})
async function handleAction(): Promise<void> {
if (isLoading.value && !categorySkeleton.value) return
isLoading.value = true
const categoryName = categorySkeleton.value?.name
const { error } = await tryCatch(deleteCategoryFromSkeleton())
if (error) {
formErrors.message = error.message
isLoading.value = false
return
}
toast({
title: t("entity.category.deletedToast.title", { category: categoryName }),
variant: "success",
duration: ToastLifetime.MEDIUM
})
isLoading.value = false
}
/**
* Click on the cancel button
*
* Must cancel the abortController in the store, and stop the loading
*/
function handleCancel(): void {
cancelLatestRequest()
isLoading.value = false
}
</script>
<template>
<form @submit.prevent="handleAction">
<div class="grid grid-cols-2 gap-y-4">
<div class="text-red-500 ml-8">
<span class="text-sm">
{{ formErrors.message }}
</span>
</div>
</div>
<footer class="flex gap-2 justify-between">
<UiButton type="button" size="sm" variant="outline" @click="() => isDeletingCategory = false">
{{ $t('ui.action.back') }}
</UiButton>
<div class="flex gap-2 justify-end">
<Transition name="fade-delay">
<UiButton v-if="isLoading" type="button" size="sm" variant="destructive" @click.prevent="handleCancel">
{{ $t('ui.action.cancel') }}
</UiButton>
</Transition>
<UiButton size="sm" variant="destructive" :disabled="isLoading">
<Transition name="fade">
<PhCircleNotch v-if="isLoading" size="20" class="animate-spin"/>
</Transition>
{{ $t('ui.action.delete') }}
</UiButton>
</div>
</footer>
</form>
</template>

View File

@@ -1,6 +1,7 @@
<script lang="ts" setup>
import { PhCircleNotch } from "@phosphor-icons/vue";
import { useToast } from "~/components/ui/toast";
import { ToastLifetime } from "~/components/ui/toast/use-toast";
const { resetSkeleton, deleteEventFromSkeleton, cancelLatestRequest } = useCalendar()
const { isDeleteEventModalOpen, eventSkeleton } = storeToRefs(useCalendar())
@@ -21,8 +22,13 @@ async function handleAction(): Promise<void> {
const eventTitle = eventSkeleton.value.title
try {
await deleteEventFromSkeleton()
const { error } = await tryCatch(deleteEventFromSkeleton())
if (error) {
formErrors.message = error.message
isLoading.value = false
return
}
isDeleteEventModalOpen.value = false
resetSkeleton()
@@ -30,15 +36,9 @@ async function handleAction(): Promise<void> {
toast({
title: t("entity.calendar.event.deletedToast.title", { event: eventTitle }),
variant: "success",
duration: 3000
duration: ToastLifetime.MEDIUM
})
} catch (err) {
if (err instanceof Error) {
formErrors.message = err.message
}
} finally {
isLoading.value = false
}
}
/**

View File

@@ -0,0 +1,153 @@
<script lang="ts" setup>
import type { Calendar } from "~/models/CalendarConfig";
import { PhCircleNotch, PhWrench } from "@phosphor-icons/vue";
import type { World } from "~/models/World";
const props = defineProps<{
calendar: Calendar | null,
world: World | null,
}>()
const calendarSkeleton = ref<Calendar>({ ...props.calendar } as Calendar)
onMounted(() => {
calendarSkeleton.value = { ...props.calendar } as Calendar
})
type FormTabs = "global" | "months" | "today"
const activeTab = ref<FormTabs>("global")
/**
* === Form Validation ===
*/
/** Whether the skeleton has valid month data */
const validSkeletonMonths = computed(() => calendarSkeleton.value.months.length > 0)
/** Whether the skeleton has a valid name */
const validSkeletonGeneral = computed(() => calendarSkeleton.value.name)
/** Whether all the data checks above are a-ok */
const validSkeleton = computed(() => validSkeletonGeneral.value && validSkeletonMonths.value)
/** Send the data to the store for validation */
const isUpdatingCalendar = ref<boolean>(false)
async function handleSubmit() {
isUpdatingCalendar.value = true
const fetchBody = { ...calendarSkeleton.value, worldId: props.world?.id }
const { error } = await tryCatch(
$fetch(`/api/calendars/${calendarSkeleton.value.id}`, { method: "PATCH", body: fetchBody })
)
if (error) {
console.log(error.message)
isUpdatingCalendar.value = false
return
}
emit("on-close")
isUpdatingCalendar.value = false
}
/**
* === Watch for name changes to display above ===
*/
const emit = defineEmits<{
// eslint-disable-next-line no-unused-vars
(e: "on-changed-name", calendarName: string): void
// eslint-disable-next-line no-unused-vars
(e: "on-close"): void
}>()
/** Hook to emit a debounced event for the changed skeleton name */
const handleNameChange = useDebounceFn(() => {
emit("on-changed-name", calendarSkeleton.value.name)
}, 400)
function handleFormCancel() {
emit("on-close")
}
</script>
<template>
<template v-if="calendarSkeleton">
<form class="h-full grid grid-rows-[1fr_auto]" @submit.prevent="handleSubmit">
<UiTabs v-model:model-value="activeTab">
<UiTabsList class="grid w-full grid-cols-1 mb-4">
<UiTabsTrigger value="global" class="font-bold">
<div class="flex items-center gap-1">
<PhWrench size="18" weight="fill" />
{{ $t('entity.calendar.actionDialog.tabs.general.title') }}
</div>
</UiTabsTrigger>
<!-- <UiTabsTrigger value="months" class="font-bold">
<div class="flex items-center gap-1">
<PhCalendarDots size="18" weight="fill" />
{{ $t('entity.calendar.actionDialog.tabs.months.title') }}
</div>
</UiTabsTrigger>
<UiTabsTrigger value="today" class="font-bold">
<div class="flex items-center gap-1">
<PhAlarm size="18" weight="fill" />
{{ $t('entity.calendar.actionDialog.tabs.today.title') }}
</div>
</UiTabsTrigger> -->
</UiTabsList>
<UiTabsContent value="global" class="grid gap-4">
<input
id="new-calendar-name"
v-model="calendarSkeleton.name"
type="text"
name="new-calendar-name"
required
:placeholder="$t('common.title')"
class="w-full py-2 -mx-1 px-1 text-xl border-b-[1px] bg-transparent focus-visible:outline-hidden focus-visible:border-blue-600"
@input="handleNameChange"
>
<div class="-mx-1 px-1 grid gap-3">
<UiLabel for="new-calendar-state">
{{ $t('ui.contentState.label') }}
</UiLabel>
<InputContentState id="new-calendar-state" v-model="calendarSkeleton.state" />
</div>
<div class="-mx-1 grid gap-3">
<UiLabel for="new-calendar-color">
{{ $t('ui.colors.label') }}
</UiLabel>
<InputColor id="new-calendar-color" v-model="calendarSkeleton.color" />
</div>
</UiTabsContent>
<!-- <UiTabsContent value="months">
<CalendarInputMonthList v-model:model-value="calendarSkeleton.months" />
</UiTabsContent>
<UiTabsContent value="today">
<CalendarInputTodaySelect v-model:model-value="calendarSkeleton.today" :available-months="calendarSkeleton.months"/>
</UiTabsContent> -->
</UiTabs>
<footer class="flex justify-end gap-2 mt-6">
<UiButton type="button" variant="destructive" @click="handleFormCancel">
{{ $t('ui.action.cancel') }}
</UiButton>
<UiButton type="submit" :disabled="!validSkeleton || isUpdatingCalendar">
<Transition name="fade">
<PhCircleNotch v-if="isUpdatingCalendar" size="20" class="opacity-50 animate-spin"/>
</Transition>
{{ $t('ui.action.save') }}
</UiButton>
</footer>
</form>
</template>
</template>

View File

@@ -1,6 +1,7 @@
<script lang="ts" setup>
import { PhAlarm, PhCircleNotch, PhEye, PhEyeClosed, PhMapPinArea, PhPencilSimpleLine, PhTag } from "@phosphor-icons/vue"
import { useToast } from "~/components/ui/toast";
import { ToastLifetime } from "~/components/ui/toast/use-toast";
import type { APIError } from "~/models/Errors";
const emit = defineEmits(["event-updated"])
@@ -22,32 +23,35 @@ async function handleAction() {
isLoading.value = true
try {
await updateEventFromSkeleton()
const { error } = await tryCatch(updateEventFromSkeleton())
emit("event-updated")
toast({
title: t("entity.calendar.event.updatedToast.title", { event: eventSkeleton.value.title }),
variant: "success",
duration: 3000
})
} catch (err) {
if (error) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const apiError = (err as any).data as APIError
const apiError = (error as any).data as APIError
apiError.data.errors.forEach((error) => {
toast({
title: t("entity.calendar.event.editErrors.toastTitle"),
variant: "destructive",
description: t(`entity.calendar.event.editErrors.${error.path[1]}_${error.code}`),
duration: 2000,
duration: ToastLifetime.MEDIUM,
})
})
} finally {
resetSkeleton()
isLoading.value = false
return
}
emit("event-updated")
toast({
title: t("entity.calendar.event.updatedToast.title", { event: eventSkeleton.value.title }),
variant: "success",
duration: ToastLifetime.SHORT
})
isLoading.value = false
resetSkeleton()
}
/**
@@ -78,7 +82,7 @@ function handleCancel() {
:placeholder="$t('entity.calendar.event.title')"
:minlength="3"
:maxlength="120"
class="w-full -my-1 py-1 -mx-1 px-1 text-lg border-b-[1px] bg-transparent focus-visible:outline-none focus-visible:border-blue-600 invalid:border-red-500"
class="w-full -my-1 py-1 -mx-1 px-1 text-lg border-b-[1px] bg-transparent focus-visible:outline-hidden focus-visible:border-blue-600 invalid:border-red-500"
>
<div class="mt-2 mb-1 text-xs opacity-50">
{{ t('entity.calendar.event.patterns.title') }}
@@ -94,7 +98,7 @@ function handleCancel() {
name="new-event-description"
:placeholder="$t('entity.addDescription')"
:maxlength="1200"
class="w-full -my-1 py-1 -mx-1 px-1 min-h-24 max-h-36 text-sm border-b-[1px] bg-transparent focus-visible:outline-none focus-visible:border-blue-600 invalid:border-red-500"
class="w-full -my-1 py-1 -mx-1 px-1 min-h-24 max-h-36 text-sm border-b-[1px] bg-transparent focus-visible:outline-hidden focus-visible:border-blue-600 invalid:border-red-500"
/>
<div class="mt-2 mb-1 text-xs opacity-50">
{{ t('entity.calendar.event.patterns.description') }}
@@ -158,7 +162,7 @@ function handleCancel() {
:placeholder="$t('entity.calendar.event.addLocation')"
:minlength="3"
:maxlength="160"
class="w-full -my-1 py-2 px-2 text-sm border-b-[1px] bg-transparent focus-visible:outline-none focus-visible:border-blue-600 invalid:border-red-500"
class="w-full -my-1 py-2 px-2 text-sm border-b-[1px] bg-transparent focus-visible:outline-hidden focus-visible:border-blue-600 invalid:border-red-500"
>
<div class="mt-2 mb-1 text-xs opacity-50">

View File

@@ -50,7 +50,7 @@ const filteredCategories = computed(() =>
</ul>
</template>
<PhCaretDown class="ml-2 h-4 w-4 shrink-0 opacity-50" />
<PhCaretDown class="ml-2 size-4 shrink-0 opacity-50" />
</UiButton>
</UiPopoverTrigger>
<UiPopoverContent

View File

@@ -1,5 +1,6 @@
<script lang="ts" setup>
import { PhCaretDown } from "@phosphor-icons/vue";
import { cn } from "~/lib/utils";
import type { Category } from "~/models/Category";
const isPopoverOpen = ref<boolean>(false)
@@ -39,10 +40,15 @@ const filteredCategories = computed(() =>
{{ props.placeholder }}
</template>
<template v-else>
{{ model.name }}
<span
class="bgc"
:class="cn(`element-${model.color}`)"
>
{{ capitalize(model.name) }}
</span>
</template>
<PhCaretDown class="ml-2 h-4 w-4 shrink-0 opacity-50" />
<PhCaretDown class="ml-2 size-4 shrink-0 opacity-50" />
</UiButton>
</UiPopoverTrigger>
<UiPopoverContent
@@ -51,7 +57,7 @@ const filteredCategories = computed(() =>
:collision-padding="50"
class="w-fit h-[33vh] p-0"
>
<UiCommand v-model="model" v-model:searchTerm="searchTerm">
<UiCommand v-model="model" v-model:search-term="searchTerm">
<UiCommandInput :placeholder="$t('entity.category.search')" />
<UiCommandEmpty>{{ $t('entity.category.notFoundAny') }}</UiCommandEmpty>
<UiCommandList>
@@ -63,7 +69,12 @@ const filteredCategories = computed(() =>
class="cursor-pointer"
@select="handleCatSelect"
>
{{ category.name }}
<span
class="bgc"
:class="cn(`element-${category.color}`)"
>
{{ capitalize(category.name) }}
</span>
</UiCommandItem>
</UiCommandGroup>
</UiCommandList>

View File

@@ -91,19 +91,19 @@ useSortable(monthSortableList, model.value, { animation: 150, handle: ".handle"
/>
</div>
<div class="md:col-span-1">
<UiButton size="icon" class="rounded-full h-8 w-8" :disabled="!validNewMonth" @click.prevent="addMonthToModel">
<UiButton size="icon" class="rounded-full size-8" :disabled="!validNewMonth" @click.prevent="addMonthToModel">
<PhPlus size="17"/>
</UiButton>
</div>
<div class="md:col-span-full">
<div
class="border-[1px] dark:border-slate-800 p-4 rounded-sm max-h-80 overflow-y-auto"
class="border-[1px] border-border p-4 rounded-sm max-h-80 overflow-y-auto"
:class="model.length ? 'md:grid md:grid-cols-12 md:gap-4 md:items-center' : ''"
>
<div v-if="model.length" class="hidden md:block col-span-1">
<ul class="grid gap-y-4 justify-center">
<li v-for="(m, i) in model" :key="`num-${m.name}`">
<UiButton size="icon" variant="secondary" class="h-8 w-8 rounded-full">
<UiButton size="icon" variant="secondary" class="size-8 rounded-full">
<span class="font-bold text-sm">{{ i + 1 }}</span>
</UiButton>
</li>
@@ -115,7 +115,7 @@ useSortable(monthSortableList, model.value, { animation: 150, handle: ".handle"
<template v-if="model.length">
<li v-for="(m, i) in model" :key="m.name" class="grid md:grid-cols-12 gap-4 md:items-center text-slate-900 bg-slate-200 rounded-md">
<div class="md:col-span-1 text-right duration-200 ease-out transition transform origin-top-right">
<UiButton type="button" variant="ghost" size="icon" class="handle rounded-full h-8 w-8">
<UiButton type="button" variant="ghost" size="icon" class="handle rounded-full size-8">
<PhList size="17" />
</UiButton>
</div>
@@ -145,7 +145,7 @@ useSortable(monthSortableList, model.value, { animation: 150, handle: ".handle"
<UiTooltipProvider>
<UiTooltip>
<UiTooltipTrigger as-child>
<UiButton type="button" variant="ghost" size="icon" class="rounded-full h-8 w-8" @click="removeMonthFromModel(i)">
<UiButton type="button" variant="ghost" size="icon" class="rounded-full size-8" @click="removeMonthFromModel(i)">
<PhTrash size="17" />
</UiButton>
</UiTooltipTrigger>

View File

@@ -0,0 +1,46 @@
<script lang="ts" setup>
import { useCalendar } from "~/stores/CalendarStore"
import { breakpointsTailwind } from "@vueuse/core"
const breakpoints = useBreakpoints(
breakpointsTailwind
)
const { isReadOnly, defaultDate } = storeToRefs(useCalendar())
</script>
<template>
<header class="md:mt-2 grid gap-3 md:gap-4 border-border border-b-[1px] transition-colors">
<div class="px-5 md:px-8 flex items-center justify-between gap-2">
<menu class="flex items-center md:gap-2">
<li>
<LazyCalendarDialogQuickCreateEvent v-if="!isReadOnly" />
</li>
<li class="max-md:hidden">
<LazyCalendarMenuToday v-if="defaultDate" />
</li>
<li class="ml-2 md:ml-4">
<CalendarCurrentDate />
</li>
</menu>
<menu class="flex items-center gap-2">
<li>
<CalendarSearchCTA />
</li>
<ClientOnly>
<li v-if="breakpoints.md.value">
<CalendarCategoriesCTA />
</li>
</ClientOnly>
<li>
<CalendarOptionsCTA />
</li>
</menu>
</div>
<div class="ml-4 md:ml-8">
<CalendarMenuSubnav />
</div>
</header>
</template>

View File

@@ -0,0 +1,230 @@
<script lang="ts" setup>
import { PhCaretDoubleLeft, PhCaretDoubleRight, PhCaretLeft, PhCaretRight } from "@phosphor-icons/vue"
const { currentDate } = useCalendar()
const { t } = useI18n()
interface DirectionLabels {
pastFar: string
pastNear: string
futureNear: string
futureFar: string
}
const { currentConfig, decrementViewMonth, incrementViewMonth, decrementViewYear, incrementViewYear } =
useCalendar()
const activeDirectionLabels: ComputedRef<DirectionLabels> = computed(() => {
switch (currentConfig.viewType) {
case "month":
return {
pastFar: t("entity.calendar.years.prevSingular"),
pastNear: t("entity.calendar.months.prevSingular"),
futureNear: t("entity.calendar.months.nextSingular"),
futureFar: t("entity.calendar.years.nextSingular")
}
case "year":
return {
pastFar: t("entity.calendar.decades.prevSingular"),
pastNear: t("entity.calendar.years.prevSingular"),
futureNear: t("entity.calendar.years.nextSingular"),
futureFar: t("entity.calendar.decades.nextSingular")
}
case "decade":
return {
pastFar: t("entity.calendar.centuries.prevSingular"),
pastNear: t("entity.calendar.decades.prevSingular"),
futureNear: t("entity.calendar.decades.nextSingular"),
futureFar: t("entity.calendar.centuries.nextSingular")
}
case "century":
default:
return {
pastFar: t("entity.calendar.millenias.prevSingular"),
pastNear: t("entity.calendar.centuries.prevSingular"),
futureNear: t("entity.calendar.centuries.nextSingular"),
futureFar: t("entity.calendar.millenias.nextSingular")
}
}
})
function toPastFar(): void {
switch (currentConfig.viewType) {
case "month":
decrementViewYear()
break
case "year":
decrementViewYear(10)
break
case "decade":
decrementViewYear(100)
break
case "century":
default:
decrementViewYear(1000)
break
}
}
function toPastNear(): void {
switch (currentConfig.viewType) {
case "month":
decrementViewMonth()
break
case "year":
decrementViewYear()
break
case "decade":
decrementViewYear(10)
break
case "century":
default:
decrementViewYear(100)
break
}
}
function toFutureNear(): void {
switch (currentConfig.viewType) {
case "month":
incrementViewMonth()
break
case "year":
incrementViewYear()
break
case "decade":
incrementViewYear(10)
break
case "century":
default:
incrementViewYear(100)
break
}
}
function toFutureFar(): void {
switch (currentConfig.viewType) {
case "month":
incrementViewYear()
break
case "year":
incrementViewYear(10)
break
case "decade":
incrementViewYear(100)
break
case "century":
default:
incrementViewYear(1000)
break
}
}
</script>
<template>
<div class="flex gap-2">
<div class="grid items-center w-40 px-3 md:px-4 py-2 bg-white dark:bg-black border-border border-x-[1px] border-t-[1px] rounded-t-sm text-sm max-md:text-xs transition-colors">
<ClientOnly>
<span>{{ currentDate.currentDateTitle }}</span>
<template #fallback>
<span class="inline-block">
<UiSkeleton class="h-[19px] w-full rounded-sm" />
</span>
</template>
</ClientOnly>
</div>
<div>
<UiTooltipProvider :delay-duration="250">
<UiTooltip>
<UiTooltipTrigger as-child>
<UiButton
variant="outline"
size="icon"
class="rounded-t-sm rounded-b-none border-b-0"
@click="toPastFar()"
>
<PhCaretDoubleLeft size="18" />
</UiButton>
</UiTooltipTrigger>
<UiTooltipContent>
<p>{{ activeDirectionLabels.pastFar }}</p>
</UiTooltipContent>
</UiTooltip>
</UiTooltipProvider>
</div>
<div>
<UiTooltipProvider :delay-duration="250">
<UiTooltip>
<UiTooltipTrigger as-child>
<UiButton
variant="outline"
size="icon"
class="rounded-t-sm rounded-b-none border-b-0"
@click="toPastNear()"
>
<PhCaretLeft size="18" />
</UiButton>
</UiTooltipTrigger>
<UiTooltipContent>
<p>{{ activeDirectionLabels.pastNear }}</p>
</UiTooltipContent>
</UiTooltip>
</UiTooltipProvider>
</div>
<div>
<UiTooltipProvider :delay-duration="250">
<UiTooltip>
<UiTooltipTrigger as-child>
<UiButton
variant="outline"
size="icon"
class="rounded-t-sm rounded-b-none border-b-0"
@click="toFutureNear()"
>
<PhCaretRight size="18" />
</UiButton>
</UiTooltipTrigger>
<UiTooltipContent>
<p>{{ activeDirectionLabels.futureNear }}</p>
</UiTooltipContent>
</UiTooltip>
</UiTooltipProvider>
</div>
<div>
<UiTooltipProvider :delay-duration="250">
<UiTooltip>
<UiTooltipTrigger as-child>
<UiButton
variant="outline"
size="icon"
class="rounded-t-sm rounded-b-none border-b-0"
@click="toFutureFar()"
>
<PhCaretDoubleRight size="18" />
</UiButton>
</UiTooltipTrigger>
<UiTooltipContent>
<p>{{ activeDirectionLabels.futureFar }}</p>
</UiTooltipContent>
</UiTooltip>
</UiTooltipProvider>
</div>
</div>
</template>

View File

@@ -1,5 +1,6 @@
<script lang="ts" setup>
import { computed } from "vue"
import { breakpointsTailwind, useBreakpoints } from "@vueuse/core"
import { PhCalendar } from "@phosphor-icons/vue"
const { defaultDate, jumpToDefaultDate, getFormattedDateTitle, currentDate } = useCalendar()
@@ -8,15 +9,29 @@ const defaultDateFormatted: string = getFormattedDateTitle(defaultDate, true)
const buttonDisabledState: ComputedRef<boolean> = computed<boolean>(() => {
return currentDate.currentMonth === defaultDate.month && currentDate.currentYear === defaultDate.year
})
const breakpoints = useBreakpoints(
breakpointsTailwind
)
</script>
<template>
<UiTooltipProvider :delay-duration="250">
<UiTooltip>
<UiTooltipTrigger as-child>
<UiButton size="sm" variant="secondary" :disabled="buttonDisabledState" @click="jumpToDefaultDate">
<ClientOnly>
<UiButton
:size="breakpoints.md.value ? 'default' : 'icon'"
variant="secondary"
:disabled="buttonDisabledState" @click="jumpToDefaultDate"
>
<PhCalendar v-if="!breakpoints.md.value" size="20" weight="fill" />
<span v-if="breakpoints.md.value">
{{ $t('entity.calendar.date.today') }}
</span>
</UiButton>
</ClientOnly>
</UiTooltipTrigger>
<UiTooltipContent>
<p>{{ defaultDateFormatted }}</p>

View File

@@ -2,13 +2,13 @@
import {
isCharacter,
type Character,
} from "@/models/Characters"
import type { RPGDateOrder } from "@/models/Date"
} from "~/models/Characters"
import type { RPGDateOrder } from "~/models/Date"
import {
isCalendarEvent,
type CalendarEvent,
} from "~/models/CalendarEvent"
import { capitalize } from "@/utils/Strings"
import { capitalize } from "~/utils/Strings"
import { useMagicKeys, useScroll, useStorage, whenever } from "@vueuse/core"
import { computed, ref, watch } from "vue"
import { searchUnifier, type SearchMode } from "../SearchMode"
@@ -25,10 +25,14 @@ import {
import SearchList from "./lists/SearchList.vue"
import type { Category } from "~/models/Category"
import { cn } from "~/lib/utils"
const { isAdvancedSearchOpen, allEvents } = storeToRefs(useCalendar())
const { isAdvancedSearchOpen, allEvents, categories } = storeToRefs(useCalendar())
const { characters } = storeToRefs(useCharacters())
const searchInput = shallowRef<HTMLInputElement>()
useFocus(searchInput, { initialValue: true })
const searchQuery = ref<string>("")
// const searchEnough = computed<boolean>(() => searchQuery.value.length >= 2)
@@ -204,8 +208,7 @@ watch([currentPage, selectedEntity], () => {
})
// Compute categories based on current selectedEntity
const { data: resCategories } = await useFetch("/api/calendars/categories/query")
const currentCategories = ref<Category[]>(resCategories.value?.data as Category[])
const currentCategories = computed(() => categories.value)
const selectedCategories = ref<(Category)[]>([])
const categoryFilterOpened = ref<boolean>(false)
@@ -262,10 +265,10 @@ function handleCategoryUnselect(e: Category) {
<template>
<UiDialog v-model:open="isAdvancedSearchOpen" @update:open="resetSearch()">
<UiDialogContent
class="flex flex-col flex-nowrap top-16 -translate-y-0 data-[state=closed]:slide-out-to-top-[5%] data-[state=open]:slide-in-from-top-[5%]"
:class="{
'bottom-16': searchResults.length > 0
}"
class="flex flex-col flex-nowrap top-10 -translate-y-0 data-[state=closed]:slide-out-to-top-[5%] data-[state=open]:slide-in-from-top-[5%] max-md:rounded-none"
:class="cn({
'max-md:w-full bottom-0 md:bottom-10 top-0 md:top-10': searchResults.length > 0
})"
>
<VisuallyHidden>
<UiDialogTitle> {{ $t('entity.advancedSearch.title') }} </UiDialogTitle>
@@ -281,6 +284,7 @@ function handleCategoryUnselect(e: Category) {
<div class="relative w-full h-fit">
<UiInput
id="search"
ref="searchInput"
v-model:model-value="searchQuery"
type="text"
:placeholder="$t('entity.advancedSearch.ctaPlaceholder')"
@@ -293,7 +297,7 @@ function handleCategoryUnselect(e: Category) {
</div>
<div class="flex items-center justify-between gap-8">
<div>
<div class="hidden">
<UiToggleGroup
v-model="selectedEntity"
type="single"
@@ -311,17 +315,23 @@ function handleCategoryUnselect(e: Category) {
</div>
<div class="grow flex justify-end items-center gap-1">
<UiTagsInput class="grow px-0 gap-y-1 w-80">
<UiTagsInput class="grow px-0 gap-y-1 md:w-80">
<div v-if="selectedCategories.length > 0" class="flex gap-2 flex-wrap items-center px-3">
<UiTagsInputItem v-for="item in selectedCategories" :key="item.id" :value="item.name">
<UiTagsInputItemText class="capitalize cursor-pointer" @click="handleCategoryUnselect(item)" />
<UiTagsInputItem v-for="cat in selectedCategories" :key="cat.id" :value="cat.name">
<button
class="bgc px-2 capitalize cursor-pointer"
:class="cn(`element-${cat.color}`)"
@click="handleCategoryUnselect(cat)"
>
{{ capitalize(cat.name) }}
</button>
</UiTagsInputItem>
</div>
<ComboboxRoot
v-model="selectedCategories"
v-model:open="categoryFilterOpened"
v-model:searchTerm="searchCategory"
v-model:search-term="searchCategory"
class="grow flex items-center gap-y-1 pr-2"
>
<ComboboxAnchor as-child>
@@ -342,7 +352,7 @@ function handleCategoryUnselect(e: Category) {
<ComboboxPortal :to="'#searchForm'">
<UiCommandList
position="popper"
class="w-[--radix-popper-anchor-width] rounded-md mt-2 border bg-popover text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50"
class="w-(--radix-popper-anchor-width) rounded-md mt-2 border bg-popover text-popover-foreground shadow-md outline-hidden data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50"
:dismissable="true"
>
<UiCommandEmpty />
@@ -352,8 +362,13 @@ function handleCategoryUnselect(e: Category) {
:key="cat.name"
:value="cat"
@select.prevent="handleCategorySelect(cat)"
>
<span
class="bgc"
:class="cn(`element-${cat.color}`)"
>
{{ capitalize(cat.name) }}
</span>
</UiCommandItem>
</UiCommandGroup>
</UiCommandList>
@@ -398,7 +413,7 @@ function handleCategoryUnselect(e: Category) {
</div>
</div>
<hr >
<hr>
<div v-if="searchResults.length > 0" ref="searchResultsRef" class="grow overflow-y-auto">
<SearchList
@@ -432,7 +447,7 @@ function handleCategoryUnselect(e: Category) {
as-child
>
<UiButton
class="w-10 h-10 p-0"
class="size-8 md:size-10 p-0"
:variant="item.value === currentPage ? 'default' : 'outline'"
>
{{ item.value }}

View File

@@ -1,10 +1,10 @@
<script lang="ts" setup>
import type { Character } from "@/models/Characters"
import type { RPGDate } from "@/models/Date"
import { useCalendar } from "@/stores/CalendarStore"
import type { Character } from "~/models/Characters"
import type { RPGDate } from "~/models/Date"
import { useCalendar } from "~/stores/CalendarStore"
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"
import { Button } from "@/components/ui/button"
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "~/components/ui/tooltip"
import { Button } from "~/components/ui/button"
import { PhArrowSquareOut, PhPlant, PhSkull } from "@phosphor-icons/vue"
const props = defineProps<{
@@ -21,7 +21,7 @@ console.log(props.character.birth)
</script>
<template>
<div class="block w-full text-left py-3 px-4 border-[1px] border-slate-700 rounded-sm">
<div class="block w-full text-left py-3 px-4 border-[1px] border-border rounded-sm">
<div class="grid gap-2">
<div class="flex gap-2">
<h2 class="font-bold">
@@ -37,7 +37,7 @@ console.log(props.character.birth)
</div>
</div>
<menu class="flex gap-2 border-[1px] border-slate-700 rounded-sm w-fit">
<menu class="flex gap-2 border-[1px] border-border rounded-sm w-fit">
<li v-if="character.birth">
<TooltipProvider :delay-duration="100">
<Tooltip>

View File

@@ -1,7 +1,7 @@
<script lang="ts" setup>
import { cn } from "@/lib/utils"
import type { RPGDate } from "@/models/Date"
import type { CalendarEvent } from "@/models/CalendarEvent"
import { cn } from "~/lib/utils"
import type { RPGDate } from "~/models/Date"
import type { CalendarEvent } from "~/models/CalendarEvent"
import { PhArrowSquareOut, PhHourglassMedium, PhAlarm, PhMapPinArea, PhEye } from "@phosphor-icons/vue"
@@ -21,16 +21,16 @@ const dateDuration = computed<string | null>(() => props.event.endDate ? getRela
<template>
<button
class="relative block w-full text-left py-3 px-4 rounded-sm transition-colors"
class="event-callout group relative block w-full text-left py-2 px-3 md:py-3 md:px-4 cursor-pointer transition-colors"
:class="cn(
event.category ? `event-${event.category.color}` : '',
event.category ? `element-${event.category.color}` : '',
{
'pt-4': event.hidden,
'pt-4 is-hidden': event.hidden,
})"
@click="$emit('query:date-jump', event.startDate)"
>
<div class="flex gap-2 items-center mb-1">
<h2 class="font-bold text-lg">
<h2 class="font-semibold md:font-bold md:text-lg underline-offset-4 group-hover:underline">
{{ event.title }}
</h2>
<div v-if="event.wiki">
@@ -43,7 +43,7 @@ const dateDuration = computed<string | null>(() => props.event.endDate ? getRela
</div>
</div>
<div class="flex gap-2 items-center justify-between mb-1">
<div class="flex gap-2 items-center justify-between mb-2 md:mb-1">
<template v-if="!event.endDate">
<p class="font-semibold text-sm opacity-75">
{{ getFormattedDateTitle(event.startDate, true) }}
@@ -81,15 +81,15 @@ const dateDuration = computed<string | null>(() => props.event.endDate ? getRela
<div class="mb-1 flex gap-x-2 items-center">
<template v-if="event.location">
<p class="w-fit text-sm italic opacity-75 flex items-center gap-1">
<p class="w-fit text-xs md:text-sm italic opacity-75 flex items-center gap-1">
<PhMapPinArea size="16" weight="fill" /> {{ event.location }}
</p>
</template>
<p class="w-fit text-sm italic opacity-75 flex items-center gap-1">
<p class="w-fit text-xs md:text-sm italic opacity-75 flex items-center gap-1">
<PhAlarm size="16" weight="fill" /> {{ dateDifference }}
</p>
<template v-if="dateDuration">
<p class="w-fit text-sm italic opacity-75 flex items-center gap-1">
<p class="w-fit text-xs md:text-sm italic opacity-75 flex items-center gap-1">
<PhHourglassMedium size="16" weight="fill" /> {{ $t('entity.calendar.date.while', { duration: dateDuration } )}}
</p>
</template>
@@ -111,8 +111,8 @@ const dateDuration = computed<string | null>(() => props.event.endDate ? getRela
</ul>
</div>
<div v-if="event.description" class="text-sm">
<hr class="my-2 border-white opacity-50" >
<div v-if="event.description" class="text-xs md:text-sm">
<hr class="my-3 md:my-2 border-white opacity-50" >
<span class="opacity-75">
{{ event.description }}
</span>

View File

@@ -1,7 +1,7 @@
<script lang="ts" setup>
import { isCharacter, type Character } from "@/models/Characters"
import type { RPGDate, RPGDateOrder } from "@/models/Date"
import { useCalendar } from "@/stores/CalendarStore"
import { isCharacter, type Character } from "~/models/Characters"
import type { RPGDate, RPGDateOrder } from "~/models/Date"
import { useCalendar } from "~/stores/CalendarStore"
import { computed } from "vue"
import { isCalendarEvent, type CalendarEvent } from "~/models/CalendarEvent"
import type { SearchMode } from "../../SearchMode"
@@ -60,7 +60,7 @@ const pagedResults = computed(() => sortedResults.value.slice(props.startAt, pro
</script>
<template>
<ul class="grid gap-4">
<ul class="grid gap-3 md:gap-4 pl-4 pr-6 md:pl-8 md:pr-12">
<li v-for="r in pagedResults" :key="isCalendarEvent(r) ? r.title : r.name">
<EventCallout v-if="isCalendarEvent(r)" :event="r" @query:date-jump="handleJumpToDate" />

View File

@@ -1,23 +1,31 @@
<script lang="ts" setup>
import type { RPGDate } from "@/models/Date"
import type { CalendarEvent } from "@/models/CalendarEvent"
import { useElementBounding } from "@vueuse/core"
import type { RPGDate } from "~/models/Date"
import type { CalendarEvent } from "~/models/CalendarEvent"
import { breakpointsTailwind, useElementBounding } from "@vueuse/core"
import { storeToRefs } from "pinia"
import { computed, ref, type ComputedRef } from "vue"
import CalendarEventButton from "../../CalendarEvent.vue"
import CalendarEventButton from "../../event/Event.vue"
const props = defineProps<{
date: RPGDate
faded?: boolean
}>()
const emit = defineEmits<{
(e: "on-open-create-dialog", date: RPGDate): void
}>()
const calendarTile = ref()
const calendarEventsList = ref()
const { defaultDate, selectDate, areDatesIdentical } = useCalendar()
const { defaultDate, selectDate, areDatesIdentical, getFormattedDateTitle } = useCalendar()
const { selectedDate, currentEvents, isReadOnly } = storeToRefs(useCalendar())
const breakpoints = useBreakpoints(
breakpointsTailwind
)
/**
* All events with a startDate / endDate that starts or ends on the tile
*/
@@ -73,19 +81,19 @@ const eventsNotDisplayed: ComputedRef<number> = computed<number>(() => eventsFo
<template>
<div
ref="calendarTile"
class="tile relative text-xs p-2 border-slate-400 dark:border-slate-700 dark:bg-black transition-colors"
class="tile relative p-1 md:p-2 transition-colors"
:class="{
'text-slate-300 dark:text-slate-500': props.faded,
'text-slate-500 dark:text-slate-300': !props.faded
}"
>
<button
class="relative z-10 group block w-full text-center cursor-pointer"
class="relative z-10 group block w-full text-2xs md:text-xs text-center cursor-pointer"
@click="selectDate(date)"
>
<ClientOnly>
<span
class="inline-flex w-8 h-8 aspect-square items-center justify-center rounded-full border-2 border-transparent font-bold transition-colors group-hover:border-indigo-300 dark:group-hover:border-indigo-700"
class="inline-flex size-7 md:size-8 aspect-square items-center justify-center rounded-full border-1 md:border-2 border-transparent font-bold transition-colors group-hover:border-indigo-300 dark:group-hover:border-indigo-700"
:class="{
'text-white bg-slate-600 dark:bg-slate-800': isDefaultDate && !isSelectedDate,
'text-white bg-indigo-500': isSelectedDate
@@ -99,7 +107,7 @@ const eventsNotDisplayed: ComputedRef<number> = computed<number>(() => eventsFo
<ClientOnly>
<ul
ref="calendarEventsList"
class="absolute top-12 bottom-2 inset-x-2 grid auto-rows-min gap-1 z-10 pointer-events-none transition-opacity"
class="absolute top-9 md:top-12 bottom-1 md:bottom-2 inset-x-2 grid auto-rows-min gap-1 z-10 pointer-events-none transition-opacity"
:class="{
'opacity-40': props.faded && !isSelectedDate
}"
@@ -114,17 +122,23 @@ const eventsNotDisplayed: ComputedRef<number> = computed<number>(() => eventsFo
<UiPopover>
<UiPopoverTrigger as-child>
<button
class="text-xs px-2 py-1 block w-full text-left font-bold rounded-sm whitespace-nowrap overflow-hidden text-ellipsis cursor-pointer transition-colors hover:bg-slate-800"
class="text-2xs md:text-xs px-[5px] py-[5px] md:px-2 md:py-1 block w-full text-left font-bold rounded-sm whitespace-nowrap overflow-hidden text-ellipsis cursor-pointer transition-colors hover:text-foreground hover:bg-foreground/10"
>
{{ eventsNotDisplayed }} autre{{ eventsNotDisplayed > 1 ? 's' : '' }}
</button>
</UiPopoverTrigger>
<UiPopoverContent class="w-80" :align="'center'" :side="'right'">
<div class="text-center mb-4">
<span
class="inline-flex w-12 h-12 aspect-square items-center justify-center text-lg font-semibold text-slate-300 bg-slate-800 rounded-full"
<UiPopoverContent
class="w-80"
:align="'center'"
:align-offset="breakpoints.lg.value ? 50 : 25"
:collision-padding="breakpoints.lg.value ? 50 : 25"
:side="breakpoints.lg.value ? 'left' : 'bottom'"
>
{{ date.day }}
<div class="text-center mb-2">
<span
class="text-lg font-semibold rounded-full"
>
{{ getFormattedDateTitle(date, true) }}
</span>
</div>
<ul class="grid auto-rows-min gap-1 z-10 pointer-events-none transition-opacity">
@@ -143,20 +157,20 @@ const eventsNotDisplayed: ComputedRef<number> = computed<number>(() => eventsFo
</ClientOnly>
<ClientOnly>
<LazyCalendarDialogCreateEvent v-if="!isReadOnly" :date btn-class="absolute inset-0 w-full h-full cursor-default z-0" />
<LazyCalendarDialogCreateEvent v-if="!isReadOnly && breakpoints.lg.value" :date btn-class="absolute inset-0 w-full h-full cursor-default z-0" />
<button
v-else-if="!isReadOnly && !breakpoints.lg.value"
class="absolute inset-0 w-full h-full cursor-default z-0"
@click="emit('on-open-create-dialog', props.date)"
/>
</ClientOnly>
</div>
</template>
<style lang="scss" scoped>
.tile {
&:not(:nth-child(10n)) {
border-right-width: 1px;
}
&:nth-child(n + 11) {
border-top-width: 1px;
}
border-bottom-width: 1px;
}
.event-enter-active {

View File

@@ -1,11 +1,16 @@
<script lang="ts" setup>
import { useCalendar } from "@/stores/CalendarStore"
import { useCalendar } from "~/stores/CalendarStore"
import { useThrottleFn } from "@vueuse/core"
import type { RPGDate } from "~/models/Date"
import { VisuallyHidden } from "radix-vue"
const { currentDate, decrementViewMonth, incrementViewMonth } = useCalendar()
const { currentMonthData } = storeToRefs(useCalendar())
const { currentDate, decrementViewMonth, incrementViewMonth, resetSkeleton } = useCalendar()
const { currentMonthData, operationInProgress, eventSkeleton } = storeToRefs(useCalendar())
function handleWheel(e: WheelEvent) {
// Prevent scrolling
e.preventDefault()
const isMovingUp = e.deltaY < 0
if (isMovingUp) {
moveCalendarLeft()
@@ -21,10 +26,43 @@ const moveCalendarLeft = useThrottleFn(() => {
const moveCalendarRight = useThrottleFn(() => {
incrementViewMonth()
}, 100)
const isDialogOpen = ref<boolean>(false);
/**
* Opens event creation's popover
*/
function handleDialogOpen(date: RPGDate) {
// If another operation is in progress, whether it's another create popup or a modal, don't bother opening it
if (operationInProgress.value) {
isDialogOpen.value = false
return
}
resetSkeleton()
isDialogOpen.value = true
// Set skeleton initial startDate if it's known
if (date) {
eventSkeleton.value.startDate = date
}
}
function toggleDialog() {
isDialogOpen.value = !isDialogOpen.value;
};
/**
* Prevents the modal from closing if's still loading
*/
function handleClosing() {
setTimeout(() => resetSkeleton(), 100)
}
</script>
<template>
<div class="grid grid-cols-10" @wheel="handleWheel">
<div class="grid grid-cols-5 md:grid-cols-7 lg:grid-cols-10" @wheel="handleWheel">
<template v-if="currentMonthData">
<CalendarStateMonthlyDayTile
v-for="day in currentMonthData?.days"
@@ -34,7 +72,29 @@ const moveCalendarRight = useThrottleFn(() => {
month: currentDate.currentMonth,
year: currentDate.currentYear
}"
@on-open-create-dialog="handleDialogOpen"
/>
<UiDialog v-model:open="isDialogOpen">
<UiDialogContent
class="max-md:translate-0 max-md:inset-0 max-md:w-full max-md:block"
:trap-focus="true"
@escape-key-down="handleClosing"
@pointer-down-outside.prevent="null"
>
<UiDialogTitle class="max-md:mb-8">
{{ $t("entity.calendar.event.addSingle") }}
</UiDialogTitle>
<VisuallyHidden>
<UiDialogDescription>
{{ $t("entity.calendar.event.addSingleDescription") }}
</UiDialogDescription>
</VisuallyHidden>
<CalendarFormCreateEvent @event-created="toggleDialog" />
</UiDialogContent>
</UiDialog>
</template>
</div>
</template>

View File

@@ -1,5 +1,5 @@
<script lang="ts" setup>
import type { RPGDate } from "@/models/Date"
import type { RPGDate } from "~/models/Date"
import { storeToRefs } from "pinia"
import { computed, type ComputedRef } from "vue"

View File

@@ -1,5 +1,5 @@
<script lang="ts" setup>
import { useCalendar } from "@/stores/CalendarStore"
import { useCalendar } from "~/stores/CalendarStore"
import { useThrottleFn } from "@vueuse/core"
const { decrementViewYear, incrementViewYear } = useCalendar()

View File

@@ -0,0 +1,21 @@
<script lang="ts" setup>
import { PhPlusCircle } from "@phosphor-icons/vue";
const emit = defineEmits(["on-click"])
</script>
<template>
<UiCard
class="h-full lg:w-fit transition-all bg-transparent hover:text-slate-900 text-slate-500 dark:hover:text-slate-100 dark:text-slate-500 dark:focus-within:outline-gray-900 hover:-translate-y-0"
has-click
@on-click="emit('on-click')"
>
<UiCardHeader class="h-full justify-center items-center text-center gap-0">
<PhPlusCircle size="38" weight="fill" />
<UiCardTitle class="text-xl">
<slot />
</UiCardTitle>
</UiCardHeader>
</UiCard>
</template>

View File

@@ -0,0 +1,66 @@
<script setup lang="ts">
import { PhCaretRight } from "@phosphor-icons/vue";
const route = useRoute()
export type BreadcrumbItem = {
label?: string;
translateKey?: string;
to?: string;
}
defineProps<{
items?: BreadcrumbItem[];
}>()
</script>
<template>
<div class="flex gap-3 items-center">
<div class="md:hidden">
<SidebarToggle />
</div>
<UiBreadcrumb>
<UiBreadcrumbList>
<UiBreadcrumbItem v-if="route.path !== '/my'">
<UiBreadcrumbLink as-child>
<NuxtLink to="/my">
{{ $t("breadcrumbs.profile") }}
</NuxtLink>
</UiBreadcrumbLink>
</UiBreadcrumbItem>
<UiBreadcrumbItem v-else>
<UiBreadcrumbPage>
{{ $t("breadcrumbs.profile") }}
</UiBreadcrumbPage>
</UiBreadcrumbItem>
<template v-for="(item, index) in items" :key="index">
<UiBreadcrumbSeparator>
<PhCaretRight />
</UiBreadcrumbSeparator>
<UiBreadcrumbItem>
<UiBreadcrumbLink v-if="item.to" as-child>
<NuxtLink :to="item.to">
<template v-if="item.label">
{{ item.label }}
</template>
<template v-else>
{{ $t(`breadcrumbs.${item.translateKey}`) }}
</template>
</NuxtLink>
</UiBreadcrumbLink>
<UiBreadcrumbPage v-else>
<template v-if="item.label">
{{ item.label }}
</template>
<template v-else>
{{ $t(`breadcrumbs.${item.translateKey}`) }}
</template>
</UiBreadcrumbPage>
</UiBreadcrumbItem>
</template>
</UiBreadcrumbList>
</UiBreadcrumb>
</div>
</template>

View File

@@ -1,5 +1,5 @@
<script lang="ts" setup>
type HeadingLevel = "h1" | "h2" | "h3"
type HeadingLevel = "h0" | "h1" | "h2" | "h3"
interface HeadingProps {
level?: HeadingLevel
@@ -11,13 +11,16 @@ withDefaults(defineProps<HeadingProps>(), {
</script>
<template>
<h1 v-if="level === 'h1'" class="text-4xl font-bold flex">
<h1 v-if="level === 'h0'" class="text-4xl md:text-6xl font-bold flex">
<slot />
</h1>
<h2 v-else-if="level === 'h2'" class="text-2xl font-bold flex">
<h1 v-else-if="level === 'h1'" class="text-2xl md:text-4xl font-bold flex">
<slot />
</h1>
<h2 v-else-if="level === 'h2'" class="text-xl md:text-2xl font-bold flex">
<slot />
</h2>
<h3 v-if="level === 'h3'" class="text-xl font-bold flex">
<h3 v-if="level === 'h3'" class="text-lg md:text-xl font-bold flex">
<slot />
</h3>
</template>

View File

@@ -0,0 +1,21 @@
<script lang="ts" setup>
const { lineNb = 3 } = defineProps<{
lineNb?: number
}>()
</script>
<template>
<UiCard class="w-full h-full flex flex-col">
<UiCardHeader>
<UiCardTitle>
<UiSkeleton class="w-2/3 max-w-full h-8" />
</UiCardTitle>
</UiCardHeader>
<UiCardContent class="grow grid gap-2">
<UiSkeleton class="w-full max-w-full h-6" />
<template v-for="(l, i) in lineNb" :key="i">
<UiSkeleton class="max-w-full h-6" :style="`width: ${Math.floor(Math.random() * 100) + 1}%`" />
</template>
</UiCardContent>
</UiCard>
</template>

View File

@@ -1,17 +1,38 @@
<script lang="ts" setup>
import { cn } from "~/lib/utils";
import { type RPGColor, rpgColors } from "~/models/Color";
const model = defineModel<RPGColor>()
const { id, theme = "normal", position = "popper" } = defineProps<{
id: string
theme?: "normal" | "subtle"
position?: "item-aligned" | "popper" | undefined
}>();
const model = defineModel<RPGColor>({ default: "white" });
</script>
<template>
<UiSelect v-model="model">
<UiSelectTrigger>
<UiSelectValue :placeholder="$t('ui.colors.selectOne')" />
<UiSelectTrigger :id :class="cn({ 'h-9': theme === 'subtle' })">
<UiSelectValue
:placeholder="$t('ui.colors.selectOne')"
class="bgc"
:class="cn(`element-${model}`)"
/>
</UiSelectTrigger>
<UiSelectContent>
<UiSelectContent :position>
<UiSelectGroup>
<UiSelectItem v-for="color in rpgColors" :key="color" :value="color">
<UiSelectItem
v-for="color in rpgColors"
:key="color"
:value="color"
class="bgc"
:class="
cn(
`element-${color}`,
)
"
>
{{ $t(`ui.colors.${color}`) }}
</UiSelectItem>
</UiSelectGroup>

View File

@@ -0,0 +1,30 @@
<script lang="ts" setup>
import { contentStates, type ContentState } from "~/models/Entity";
defineProps<{
id: string
}>();
const model = defineModel<ContentState>({ default: "draft" });
</script>
<template>
<UiSelect v-model="model">
<UiSelectTrigger :id>
<UiSelectValue
:placeholder="$t('ui.contentState.selectOne')"
/>
</UiSelectTrigger>
<UiSelectContent position="popper">
<UiSelectGroup>
<UiSelectItem
v-for="state in contentStates"
:key="state"
:value="state"
>
{{ $t(`ui.contentState.${state}`) }}
</UiSelectItem>
</UiSelectGroup>
</UiSelectContent>
</UiSelect>
</template>

View File

@@ -1,37 +1,91 @@
<script lang="ts" setup>
import { PhCompass, PhList } from "@phosphor-icons/vue"
import type { SidebarMenuActionType } from "./SidebarProps";
import { PhCompass, PhGlobeHemisphereEast, PhHurricane, PhX } from "@phosphor-icons/vue"
import type { SidebarMenuActionType, SidebarMenuIcon } from "./SidebarProps";
import { cn } from "~/lib/utils";
import { breakpointsTailwind } from "@vueuse/core"
const { revealAdvancedSearch } = useCalendar()
const { currentMenu } = storeToRefs(useUiStore())
// const user = useSupabaseUser()
const { toggleSidebar } = useUiStore()
const { currentMenu, isSidebarOpened } = storeToRefs(useUiStore())
function handleMenuItemAction(actionType: SidebarMenuActionType) {
if (actionType === "event-search") {
revealAdvancedSearch()
}
}
function computeMenuItemIcon(iconString: SidebarMenuIcon) {
switch (iconString) {
case "universe":
return PhHurricane
case "world":
return PhGlobeHemisphereEast
default:
return PhCompass
}
}
const breakpoints = useBreakpoints(
breakpointsTailwind
)
// const sidebarRef = ref(null)
// onClickOutside(sidebarRef, () => {
// isSidebarOpened.value = false
// })
</script>
<template>
<nav class="w-16 py-6 border-r-[1px] bg-indigo-700 dark:bg-black text-white border-r-indigo-700 dark:border-r-indigo-950 grid grid-rows-[1fr_auto] justify-center transition-colors">
<menu class="flex flex-col gap-4">
<li class="mb-12">
<UiButton variant="ghost" size="icon" class="rounded-full" @click="console.log">
<PhList size="27" />
<nav
ref="sidebarRef"
:class="cn(
['md:relative md:isolate w-16 py-6 grid gap-4 grid-rows-[1fr_auto] justify-center transition-all'], // Base appearance
['after:opacity-50 after:contrast-125 dark:after:opacity-75 dark:after:contrast-175 after:-hue-rotate-60'], // After styling
['border-r-[1px] bg-indigo-700 dark:bg-black text-white border-r-indigo-700 dark:border-r-indigo-950 shadow-navbar-light dark:shadow-navbar-dark'], // Colours
['max-md:justify-stretch max-md:px-4 max-md:py-4 max-md:absolute max-md:left-0 max-md:inset-0 max-md:z-50 max-md:w-30 max-md:max-w-full'], // Responsive behaviours
{
'max-md:-translate-x-30': !isSidebarOpened,
'max-md:-translate-x-0 shadow-navbar-dark dark:bg-slate-950': isSidebarOpened
}
)"
>
<menu class="flex flex-col gap-4 max-md:items-center">
<li class="mb-12 mt-4 max-md:self-start">
<UiButton
variant="outline"
size="icon"
class="md:hidden size-9 border-background/30"
@click="toggleSidebar"
>
<PhX size="19" />
</UiButton>
</li>
<li>
<UiTooltipProvider :delay-duration="50">
<li class="max-md:self-start">
<UiTooltipProvider :delay-duration="50" :disabled="!breakpoints.md.value">
<UiTooltip>
<UiTooltipTrigger as-child>
<UiButton variant="ghost" size="icon" class="rounded-full" as-child>
<UiButton
variant="ghost"
size="icon"
class="rounded-full max-md:hidden"
as-child
>
<RouterLink to="/explore">
<PhCompass size="24" weight="fill" />
</RouterLink>
</UiButton>
<RouterLink
to="/explore"
class="md:hidden flex items-center gap-[.6ch] underline-offset-4 hover:underline"
>
<PhCompass size="22" weight="fill" />
<span class="text-[.9em]">
{{ $t('pages.explore.menuLabel') }}
</span>
</RouterLink>
</UiTooltipTrigger>
<UiTooltipContent :side="'right'" :side-offset="6">
<p>
@@ -42,17 +96,30 @@ function handleMenuItemAction(actionType: SidebarMenuActionType) {
</UiTooltipProvider>
</li>
<ClientOnly>
<li v-for="(item, i) in currentMenu" :key="i">
<UiTooltipProvider :delay-duration="50">
<UiTooltip>
<UiTooltipTrigger as-child>
<UiButton v-if="item.to" variant="ghost" size="icon" class="rounded-full" as-child>
<UiButton
v-if="item.to"
variant="ghost"
size="icon"
class="rounded-full"
as-child
>
<RouterLink :to="item.to">
<component :is="item.phIcon" size="24" weight="fill" />
<component :is="computeMenuItemIcon(item.phIcon)" size="24" :weight="item.phIconWeight || 'fill'" />
</RouterLink>
</UiButton>
<UiButton v-if="item.action" variant="ghost" size="icon" class="rounded-full" @click="handleMenuItemAction(item.action!)">
<component :is="item.phIcon" size="24" weight="fill" />
<UiButton
v-if="item.action"
variant="ghost"
size="icon"
class="rounded-full"
@click="handleMenuItemAction(item.action!)"
>
<component :is="computeMenuItemIcon(item.phIcon)" size="24" :weight="item.phIconWeight || 'fill'" />
</UiButton>
</UiTooltipTrigger>
<UiTooltipContent :side="'right'" :side-offset="6">
@@ -61,8 +128,29 @@ function handleMenuItemAction(actionType: SidebarMenuActionType) {
</UiTooltip>
</UiTooltipProvider>
</li>
</ClientOnly>
</menu>
<UserCTA />
</nav>
</template>
<style lang="scss" scoped>
nav {
&::after {
display: block;
content: '';
position: absolute;
bottom: 0;
inset-inline: 0;
height: 25rem;
max-height: 100%;
background-image: url("/images/sidebar.png");
background-position: bottom;
background-size: cover;
background-repeat: no-repeat;
mask-image: linear-gradient(to top, black 25%, transparent 50%, transparent);
z-index: -1;
}
}
</style>

View File

@@ -1,9 +1,11 @@
import type { ShallowRef } from "vue"
export type SidebarMenuActionType = "event-search"
export type SidebarMenuIcon = "universe" | "world"
export interface SidebarMenuItem {
phIcon: ShallowRef // use shallowRef to build phIcon
phIcon: SidebarMenuIcon,
phIconWeight?: "regular" | "light" | "fill" | "duotone" | "bold" | "thin"
highlight?: boolean
tooltip: string
action?: SidebarMenuActionType
to?: string

View File

@@ -0,0 +1,15 @@
<script lang="ts" setup>
import { PhList } from "@phosphor-icons/vue"
const { toggleSidebar } = useUiStore()
</script>
<template>
<UiButton
size="icon"
variant="outline"
@click="toggleSidebar"
>
<PhList size="19" weight="light" />
</UiButton>
</template>

View File

@@ -1,7 +1,7 @@
<script lang="ts" setup>
import { computed } from "vue"
import { PhCheckCircle, PhGear, PhUser, PhLaptop, PhMoon, PhPalette, PhSignIn, PhSignOut, PhSun, PhTranslate, PhUserCircle } from "@phosphor-icons/vue"
import { PhCheckCircle, PhUser, PhLaptop, PhMoon, PhPalette, PhSignIn, PhSignOut, PhSun, PhTranslate, PhUserCircle } from "@phosphor-icons/vue"
import { cn } from "~/lib/utils";
const router = useRouter()
@@ -21,8 +21,7 @@ function closeMenu() {
watch(user, closeMenu)
async function handleGoogleLogin() {
try {
auth.signInWithOAuth({
const { error } = await auth.signInWithOAuth({
provider: "google",
options: {
queryParams: {
@@ -32,18 +31,17 @@ async function handleGoogleLogin() {
redirectTo: profileUrl
}
})
} catch (err) {
console.log(err)
if (error) {
console.log(error.message)
}
}
async function handleLogout() {
try {
const { error } = await auth.signOut()
if (error) throw error
} catch (err) {
console.log(err)
if (error) {
console.log(error.message)
}
}
@@ -60,7 +58,7 @@ function pushRoute(to: AvailableRoutes) {
<ClientOnly>
<UiDropdownMenu v-model:open="menuOpened">
<UiDropdownMenuTrigger>
<UiAvatar v-if="user" class="cursor-pointer">
<UiAvatar v-if="user" id="user-avatar" class="ring-[.2rem] ring-indigo-700 dark:ring-neutral-900 cursor-pointer">
<UiAvatarImage
:src="userMeta?.avatar_url"
:alt="userMeta?.full_name"
@@ -70,7 +68,7 @@ function pushRoute(to: AvailableRoutes) {
{{ $t('ui.sidebarMenu.avatarFallback') }}
</UiAvatarFallback>
</UiAvatar>
<UiButton v-else variant="outline" size="icon" class="rounded-full">
<UiButton v-else variant="outline" size="icon" class="rounded-full border-indigo-200 bg-indigo-700 dark:border-slate-300 dark:bg-neutral-950 dark:hover:bg-slate-50 dark:hover:text-slate-950 cursor-pointer">
<PhUserCircle size="24" />
</UiButton>
</UiDropdownMenuTrigger>
@@ -186,12 +184,12 @@ function pushRoute(to: AvailableRoutes) {
<UiDropdownMenuSeparator />
<template v-if="user">
<UiDropdownMenuItem class="flex gap-[.5ch] items-center rounded-none" @click="pushRoute('/my/settings')">
<!-- <UiDropdownMenuItem class="flex gap-[.5ch] items-center rounded-none" @click="pushRoute('/my/settings')">
<PhGear size="20" weight="fill" />
<span>
{{ $t('ui.sidebarMenu.account') }}
</span>
</UiDropdownMenuItem>
</UiDropdownMenuItem> -->
<UiDropdownMenuItem class="flex gap-[.5ch] items-center rounded-none" @click="handleLogout">
<PhSignOut size="20" weight="fill" />
<span>

View File

@@ -1,8 +1,8 @@
<script setup lang="ts">
import { type HTMLAttributes, computed } from "vue"
import { AlertDialogAction, type AlertDialogActionProps } from "radix-vue"
import { cn } from "@/lib/utils"
import { buttonVariants } from "@/components/ui/button/index"
import { cn } from "~/lib/utils"
import { buttonVariants } from "~/components/ui/button/index"
const props = defineProps<AlertDialogActionProps & { class?: HTMLAttributes["class"] }>()

View File

@@ -1,8 +1,8 @@
<script setup lang="ts">
import { type HTMLAttributes, computed } from "vue"
import { AlertDialogCancel, type AlertDialogCancelProps } from "radix-vue"
import { cn } from "@/lib/utils"
import { buttonVariants } from "@/components/ui/button/index"
import { cn } from "~/lib/utils"
import { buttonVariants } from "~/components/ui/button/index"
const props = defineProps<AlertDialogCancelProps & { class?: HTMLAttributes["class"] }>()

View File

@@ -8,7 +8,7 @@ import {
AlertDialogPortal,
useForwardPropsEmits,
} from "radix-vue"
import { cn } from "@/lib/utils"
import { cn } from "~/lib/utils"
const props = defineProps<AlertDialogContentProps & { class?: HTMLAttributes["class"] }>()
const emits = defineEmits<AlertDialogContentEmits>()
@@ -25,13 +25,13 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits)
<template>
<AlertDialogPortal>
<AlertDialogOverlay
class="fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"
class="fixed inset-0 z-50 bg-black/60 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"
/>
<AlertDialogContent
v-bind="forwarded"
:class="
cn(
'fixed left-1/2 top-1/2 z-50 grid w-full max-w-3xl -translate-x-1/2 -translate-y-1/2 gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg',
'fixed left-1/2 top-1/2 z-50 grid w-[calc(100%-2rem)] max-w-3xl -translate-x-1/2 -translate-y-1/2 gap-4 border border-indigo-200 bg-background dark:bg-slate-950 dark:border-indigo-950 p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-50% data-[state=closed]:slide-out-to-top-48% data-[state=open]:slide-in-from-left-50% data-[state=open]:slide-in-from-top-48% rounded-lg',
props.class,
)
"

View File

@@ -4,7 +4,7 @@ import {
AlertDialogDescription,
type AlertDialogDescriptionProps,
} from "radix-vue"
import { cn } from "@/lib/utils"
import { cn } from "~/lib/utils"
const props = defineProps<AlertDialogDescriptionProps & { class?: HTMLAttributes["class"] }>()

View File

@@ -1,6 +1,6 @@
<script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { cn } from "@/lib/utils"
import { cn } from "~/lib/utils"
const props = defineProps<{
class?: HTMLAttributes["class"]

View File

@@ -1,6 +1,6 @@
<script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { cn } from "@/lib/utils"
import { cn } from "~/lib/utils"
const props = defineProps<{
class?: HTMLAttributes["class"]

View File

@@ -1,7 +1,7 @@
<script setup lang="ts">
import { type HTMLAttributes, computed } from "vue"
import { AlertDialogTitle, type AlertDialogTitleProps } from "radix-vue"
import { cn } from "@/lib/utils"
import { cn } from "~/lib/utils"
const props = defineProps<AlertDialogTitleProps & { class?: HTMLAttributes["class"] }>()

View File

@@ -2,7 +2,7 @@
import type { HTMLAttributes } from "vue"
import { AvatarRoot } from "radix-vue"
import { type AvatarVariants, avatarVariant } from "."
import { cn } from "@/lib/utils"
import { cn } from "~/lib/utils"
const props = withDefaults(defineProps<{
class?: HTMLAttributes["class"]

View File

@@ -1,7 +1,7 @@
<script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { type BadgeVariants, badgeVariants } from "."
import { cn } from "@/lib/utils"
import { cn } from "~/lib/utils"
const props = defineProps<{
variant?: BadgeVariants["variant"]

View File

@@ -3,7 +3,7 @@ import { type VariantProps, cva } from "class-variance-authority"
export { default as Badge } from "./Badge.vue"
export const badgeVariants = cva(
"inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
"inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2",
{
variants: {
variant: {

View File

@@ -0,0 +1,13 @@
<script lang="ts" setup>
import type { HTMLAttributes } from "vue"
const props = defineProps<{
class?: HTMLAttributes["class"]
}>()
</script>
<template>
<nav aria-label="breadcrumb" :class="props.class">
<slot />
</nav>
</template>

View File

@@ -0,0 +1,22 @@
<script lang="ts" setup>
import type { HTMLAttributes } from "vue"
import { cn } from "~/lib/utils"
import { PhArrowsHorizontal } from "@phosphor-icons/vue";
const props = defineProps<{
class?: HTMLAttributes["class"]
}>()
</script>
<template>
<span
role="presentation"
aria-hidden="true"
:class="cn('flex h-9 w-9 items-center justify-center', props.class)"
>
<slot>
<PhArrowsHorizontal class="size-4" />
</slot>
<span class="sr-only">More</span>
</span>
</template>

View File

@@ -0,0 +1,16 @@
<script lang="ts" setup>
import type { HTMLAttributes } from "vue"
import { cn } from "~/lib/utils"
const props = defineProps<{
class?: HTMLAttributes["class"]
}>()
</script>
<template>
<li
:class="cn('inline-flex items-center gap-1.5', props.class)"
>
<slot />
</li>
</template>

View File

@@ -0,0 +1,20 @@
<script lang="ts" setup>
import type { PrimitiveProps } from "radix-vue"
import type { HTMLAttributes } from "vue"
import { cn } from "~/lib/utils"
import { Primitive } from "radix-vue"
const props = withDefaults(defineProps<PrimitiveProps & { class?: HTMLAttributes["class"] }>(), {
as: "a",
})
</script>
<template>
<Primitive
:as="as"
:as-child="asChild"
:class="cn('transition-colors rounded-[1px] hover:text-primary focus-visible:text-primary underline-offset-4 hover:underline focus-visible:underline focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-4', props.class)"
>
<slot />
</Primitive>
</template>

View File

@@ -0,0 +1,16 @@
<script lang="ts" setup>
import type { HTMLAttributes } from "vue"
import { cn } from "~/lib/utils"
const props = defineProps<{
class?: HTMLAttributes["class"]
}>()
</script>
<template>
<ol
:class="cn('flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5', props.class)"
>
<slot />
</ol>
</template>

View File

@@ -0,0 +1,19 @@
<script lang="ts" setup>
import type { HTMLAttributes } from "vue"
import { cn } from "~/lib/utils"
const props = defineProps<{
class?: HTMLAttributes["class"]
}>()
</script>
<template>
<span
role="link"
aria-disabled="true"
aria-current="page"
:class="cn('font-normal text-foreground', props.class)"
>
<slot />
</span>
</template>

View File

@@ -0,0 +1,21 @@
<script lang="ts" setup>
import type { HTMLAttributes } from "vue"
import { cn } from "~/lib/utils"
import { PhCaretRight } from "@phosphor-icons/vue";
const props = defineProps<{
class?: HTMLAttributes["class"]
}>()
</script>
<template>
<li
role="presentation"
aria-hidden="true"
:class="cn('[&>svg]:w-3 [&>svg]:h-3', props.class)"
>
<slot>
<PhCaretRight />
</slot>
</li>
</template>

View File

@@ -0,0 +1,7 @@
export { default as Breadcrumb } from "./Breadcrumb.vue"
export { default as BreadcrumbEllipsis } from "./BreadcrumbEllipsis.vue"
export { default as BreadcrumbItem } from "./BreadcrumbItem.vue"
export { default as BreadcrumbLink } from "./BreadcrumbLink.vue"
export { default as BreadcrumbList } from "./BreadcrumbList.vue"
export { default as BreadcrumbPage } from "./BreadcrumbPage.vue"
export { default as BreadcrumbSeparator } from "./BreadcrumbSeparator.vue"

View File

@@ -2,7 +2,7 @@
import type { HTMLAttributes } from "vue"
import { Primitive, type PrimitiveProps } from "radix-vue"
import { type ButtonVariants, buttonVariants } from "."
import { cn } from "@/lib/utils"
import { cn } from "~/lib/utils"
interface Props extends PrimitiveProps {
variant?: ButtonVariants["variant"]
@@ -20,15 +20,15 @@ const props = withDefaults(defineProps<Props>(), {
<Primitive
:as="as"
:as-child="asChild"
:class="cn(buttonVariants({ variant, size }), props.class, 'group')"
:class="cn(buttonVariants({ variant, size }), props.class, 'group cursor-pointer')"
>
<slot />
<span
v-if="props.searchSlash"
class="h-4 p-1 ml-1 grid place-items-center text-[0.7em] leading-none font-semibold text-slate-500 bg-slate-100 border-slate-300 border-[1px] rounded-[3px] shadow-sm group-hover:text-slate-600 group-hover:bg-slate-200 group-hover:border-slate-400 transition-colors"
class="h-4 p-1 ml-1 grid place-items-center text-[0.7em] leading-none font-semibold text-slate-500 bg-slate-100 border-slate-300 border-[1px] rounded-[3px] shadow-xs group-hover:text-slate-600 group-hover:bg-slate-200 group-hover:border-slate-400 transition-colors"
>
<span class="-mt-[2px]">CTRL + :</span>
<kbd class="-mt-[2px]">CTRL + :</kbd>
</span>
</Primitive>
</template>

View File

@@ -3,14 +3,14 @@ import { type VariantProps, cva } from "class-variance-authority"
export { default as Button } from "./Button.vue"
export const buttonVariants = cva(
"inline-flex items-center justify-center gap-1 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-30",
"inline-flex items-center justify-center gap-1 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-30",
{
variants: {
variant: {
default: "bg-primary text-primary-foreground hover:bg-primary/90",
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
outline: "border border-input hover:bg-accent hover:text-accent-foreground",
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
secondary: "bg-secondary text-secondary-foreground hover:bg-primary/20",
ghost: "hover:bg-accent hover:text-accent-foreground",
link: "text-primary underline-offset-4 hover:underline"
},

View File

@@ -1,28 +1,36 @@
<script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { cn } from "@/lib/utils"
import { cn } from "~/lib/utils"
const props = defineProps<{
class?: HTMLAttributes["class"]
link?: string
hasClick?: boolean
}>()
const emit = defineEmits(["on-click"])
</script>
<template>
<div
:class="
cn('rounded-lg border bg-card text-card-foreground shadow-sm transition-all isolate', props.class, {
'relative outline outline-2 outline-offset-4 outline-transparent hover:-translate-y-[.2rem]':
props.link
cn('rounded-lg border bg-card text-card-foreground shadow-xs transition-all isolate', props.class, {
'relative hover:-translate-y-[.2rem]':
props.link || props.hasClick
})
"
>
<slot />
<NuxtLink
v-if="props.link"
:to="props.link"
class="absolute inset-0 z-10 focus-visible:outline-none"
class="rounded-lg focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 absolute inset-0 z-10 cursor-pointer"
/>
<button
v-if="props.hasClick"
class="rounded-lg focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 absolute inset-0 z-10 cursor-pointer"
@click="emit('on-click')"
/>
<slot />
</div>
</template>

View File

@@ -1,6 +1,6 @@
<script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { cn } from "@/lib/utils"
import { cn } from "~/lib/utils"
const props = defineProps<{
class?: HTMLAttributes["class"]

View File

@@ -1,6 +1,6 @@
<script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { cn } from "@/lib/utils"
import { cn } from "~/lib/utils"
const props = defineProps<{
class?: HTMLAttributes["class"]

View File

@@ -1,6 +1,6 @@
<script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { cn } from "@/lib/utils"
import { cn } from "~/lib/utils"
const props = defineProps<{
class?: HTMLAttributes["class"]
@@ -8,7 +8,7 @@ const props = defineProps<{
</script>
<template>
<div :class="cn('flex items-center p-6 pt-0', props.class)">
<div :class="cn('flex items-center p-6 border-t-2 border-t-border', props.class)">
<slot />
</div>
</template>

View File

@@ -1,6 +1,6 @@
<script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { cn } from "@/lib/utils"
import { cn } from "~/lib/utils"
const props = defineProps<{
class?: HTMLAttributes["class"]

View File

@@ -1,6 +1,6 @@
<script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { cn } from "@/lib/utils"
import { cn } from "~/lib/utils"
const props = defineProps<{
class?: HTMLAttributes["class"]

View File

@@ -2,8 +2,8 @@
import { type HTMLAttributes, computed } from "vue"
import type { CheckboxRootEmits, CheckboxRootProps } from "radix-vue"
import { CheckboxIndicator, CheckboxRoot, useForwardPropsEmits } from "radix-vue"
import { Check } from "lucide-vue-next"
import { cn } from "@/lib/utils"
import { cn } from "~/lib/utils"
import { PhCheck } from "@phosphor-icons/vue";
const props = defineProps<CheckboxRootProps & { class?: HTMLAttributes["class"] }>()
const emits = defineEmits<CheckboxRootEmits>()
@@ -21,12 +21,12 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits)
<CheckboxRoot
v-bind="forwarded"
:class="
cn('peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground',
cn('peer size-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground',
props.class)"
>
<CheckboxIndicator class="flex h-full w-full items-center justify-center text-current">
<slot>
<Check class="h-4 w-4" />
<PhCheck class="size-4" />
</slot>
</CheckboxIndicator>
</CheckboxRoot>

View File

@@ -2,7 +2,7 @@
import { type HTMLAttributes, computed } from "vue"
import type { ComboboxRootEmits, ComboboxRootProps } from "radix-vue"
import { ComboboxRoot, useForwardPropsEmits } from "radix-vue"
import { cn } from "@/lib/utils"
import { cn } from "~/lib/utils"
const props = withDefaults(defineProps<ComboboxRootProps & { class?: HTMLAttributes["class"] }>(), {
open: true,

View File

@@ -2,7 +2,7 @@
import { useForwardPropsEmits } from "radix-vue"
import type { DialogRootEmits, DialogRootProps } from "radix-vue"
import Command from "./Command.vue"
import { Dialog, DialogContent } from "@/components/ui/dialog"
import { Dialog, DialogContent } from "~/components/ui/dialog"
const props = defineProps<DialogRootProps>()
const emits = defineEmits<DialogRootEmits>()

View File

@@ -2,7 +2,7 @@
import { type HTMLAttributes, computed } from "vue"
import type { ComboboxEmptyProps } from "radix-vue"
import { ComboboxEmpty } from "radix-vue"
import { cn } from "@/lib/utils"
import { cn } from "~/lib/utils"
const props = defineProps<ComboboxEmptyProps & { class?: HTMLAttributes["class"] }>()

View File

@@ -2,7 +2,7 @@
import { type HTMLAttributes, computed } from "vue"
import type { ComboboxGroupProps } from "radix-vue"
import { ComboboxGroup, ComboboxLabel } from "radix-vue"
import { cn } from "@/lib/utils"
import { cn } from "~/lib/utils"
const props = defineProps<
ComboboxGroupProps & {

View File

@@ -1,8 +1,8 @@
<script setup lang="ts">
import { type HTMLAttributes, computed } from "vue"
import { Search } from "lucide-vue-next"
import { ComboboxInput, type ComboboxInputProps, useForwardProps } from "radix-vue"
import { cn } from "@/lib/utils"
import { cn } from "~/lib/utils"
import { PhMagnifyingGlass } from "@phosphor-icons/vue"
defineOptions({
inheritAttrs: false
@@ -25,13 +25,13 @@ const forwardedProps = useForwardProps(delegatedProps)
<template>
<div class="flex items-center border-b px-3" cmdk-input-wrapper>
<Search class="mr-2 h-4 w-4 shrink-0 opacity-50" />
<PhMagnifyingGlass class="mr-2 size-4 shrink-0 opacity-50" />
<ComboboxInput
v-bind="{ ...forwardedProps, ...$attrs }"
auto-focus
:class="
cn(
'flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50',
'flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50',
props.class
)
"

View File

@@ -2,7 +2,7 @@
import { type HTMLAttributes, computed } from "vue"
import type { ComboboxItemEmits, ComboboxItemProps } from "radix-vue"
import { ComboboxItem, useForwardPropsEmits } from "radix-vue"
import { cn } from "@/lib/utils"
import { cn } from "~/lib/utils"
const props = defineProps<ComboboxItemProps & { class?: HTMLAttributes["class"] }>()
const emits = defineEmits<ComboboxItemEmits>()
@@ -21,7 +21,7 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits)
v-bind="forwarded"
:class="
cn(
'relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[highlighted]:bg-accent data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
'relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-hidden data-highlighted:bg-accent data-disabled:pointer-events-none data-disabled:opacity-50',
props.class
)
"

View File

@@ -2,7 +2,7 @@
import { type HTMLAttributes, computed } from "vue"
import type { ComboboxContentEmits, ComboboxContentProps } from "radix-vue"
import { ComboboxContent, useForwardPropsEmits } from "radix-vue"
import { cn } from "@/lib/utils"
import { cn } from "~/lib/utils"
const props = withDefaults(
defineProps<ComboboxContentProps & { class?: HTMLAttributes["class"] }>(),

View File

@@ -2,7 +2,7 @@
import { type HTMLAttributes, computed } from "vue"
import type { ComboboxSeparatorProps } from "radix-vue"
import { ComboboxSeparator } from "radix-vue"
import { cn } from "@/lib/utils"
import { cn } from "~/lib/utils"
const props = defineProps<ComboboxSeparatorProps & { class?: HTMLAttributes["class"] }>()

View File

@@ -1,6 +1,6 @@
<script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { cn } from "@/lib/utils"
import { cn } from "~/lib/utils"
const props = defineProps<{
class?: HTMLAttributes["class"]

View File

@@ -9,8 +9,8 @@ import {
DialogPortal,
useForwardPropsEmits
} from "radix-vue"
import { X } from "lucide-vue-next"
import { cn } from "@/lib/utils"
import { cn } from "~/lib/utils"
import { PhX } from "@phosphor-icons/vue";
const props = defineProps<DialogContentProps & { class?: HTMLAttributes["class"] }>()
const emits = defineEmits<DialogContentEmits>()
@@ -27,13 +27,13 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits)
<template>
<DialogPortal>
<DialogOverlay
class="fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"
class="fixed inset-0 z-50 bg-black/60 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"
/>
<DialogContent
v-bind="forwarded"
:class="
cn(
'fixed left-1/2 top-1/2 z-50 grid w-[calc(100%-2rem)] max-w-4xl -translate-x-1/2 -translate-y-1/2 gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg',
'fixed left-1/2 top-1/2 z-50 grid w-[calc(100%-2rem)] max-w-4xl -translate-x-1/2 -translate-y-1/2 gap-4 border bg-background border-indigo-200 dark:bg-slate-950 dark:border-indigo-950 p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-50% data-[state=closed]:slide-out-to-top-48% data-[state=open]:slide-in-from-left-50% data-[state=open]:slide-in-from-top-48% rounded-lg',
props.class
)
"
@@ -41,9 +41,9 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits)
<slot />
<DialogClose
class="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground"
class="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground"
>
<X class="w-4 h-4" />
<PhX class="w-4 h-4" />
<span class="sr-only">Close</span>
</DialogClose>
</DialogContent>

Some files were not shown because too many files have changed in this diff Show More