From 7e2989e3839e66dc23d088be9fa31ed08d142b3b Mon Sep 17 00:00:00 2001
From: Alexis <35.alexis.pele@gmail.com>
Date: Sun, 2 Mar 2025 20:02:51 +0100
Subject: [PATCH 4/7] Polished world modal behaviour
---
components/global/input/Color.vue | 100 ++++++++++++++++++++++++-
components/ui/select/SelectContent.vue | 3 +-
components/world/dialog/Create.vue | 1 +
components/world/dialog/Edit.vue | 1 +
components/world/form/Create.vue | 2 +-
models/World.ts | 2 +-
6 files changed, 102 insertions(+), 7 deletions(-)
diff --git a/components/global/input/Color.vue b/components/global/input/Color.vue
index 7f597e4..75448ec 100644
--- a/components/global/input/Color.vue
+++ b/components/global/input/Color.vue
@@ -1,20 +1,112 @@
-
+
-
+
-
+
{{ $t(`ui.colors.${color}`) }}
+
+
diff --git a/components/ui/select/SelectContent.vue b/components/ui/select/SelectContent.vue
index 2b0473f..3fb413c 100644
--- a/components/ui/select/SelectContent.vue
+++ b/components/ui/select/SelectContent.vue
@@ -36,9 +36,10 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits)
diff --git a/components/world/dialog/Edit.vue b/components/world/dialog/Edit.vue
index 661aec6..da07aa6 100644
--- a/components/world/dialog/Edit.vue
+++ b/components/world/dialog/Edit.vue
@@ -20,6 +20,7 @@ const emit = defineEmits(["on-close"])
function handleClose() {
emit("on-close")
+ worldSkeletonName.value = props.world?.name ?? ""
}
diff --git a/components/world/form/Create.vue b/components/world/form/Create.vue
index 94bbc72..d5b65fe 100644
--- a/components/world/form/Create.vue
+++ b/components/world/form/Create.vue
@@ -4,7 +4,7 @@ import type { World } from "~/models/World";
const user = useSupabaseUser()
-const defaultWorld: World = { name: "", description: "", gmId: user.value?.id }
+const defaultWorld: World = { name: "", description: "", gmId: user.value?.id, color: "white", state: "draft" }
const worldSkeleton = ref({ ...defaultWorld })
onMounted(() => {
diff --git a/models/World.ts b/models/World.ts
index 8a98fa3..d57b624 100644
--- a/models/World.ts
+++ b/models/World.ts
@@ -17,7 +17,7 @@ export interface World {
export const postWorldSchema = z.object({
name: z.string(),
description: z.string().optional().nullable(),
- color: rpgColorSchema,
+ color: rpgColorSchema.default("white"),
gmId: z.string().optional().nullable(),
state: z.string().optional().nullable().default("draft"),
})
From a83bc240b1de6cb348073ebb69cb1bea7de104ed Mon Sep 17 00:00:00 2001
From: Alexis <35.alexis.pele@gmail.com>
Date: Mon, 3 Mar 2025 12:35:59 +0100
Subject: [PATCH 5/7] Added ui card to add worlds / calendars
---
components/global/AddCard.vue | 21 +++++++++++++++++++++
components/ui/card/Card.vue | 9 ++++++++-
i18n.config.ts | 2 ++
pages/my/index.vue | 22 ++++++----------------
pages/my/worlds/[id].vue | 26 ++++++++------------------
5 files changed, 45 insertions(+), 35 deletions(-)
create mode 100644 components/global/AddCard.vue
diff --git a/components/global/AddCard.vue b/components/global/AddCard.vue
new file mode 100644
index 0000000..d2d8955
--- /dev/null
+++ b/components/global/AddCard.vue
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/ui/card/Card.vue b/components/ui/card/Card.vue
index ca0812f..6a0bdf5 100644
--- a/components/ui/card/Card.vue
+++ b/components/ui/card/Card.vue
@@ -5,7 +5,10 @@ import { cn } from "@/lib/utils"
const props = defineProps<{
class?: HTMLAttributes["class"]
link?: string
+ hasClick?: boolean
}>()
+
+const emit = defineEmits(["on-click"])
@@ -13,7 +16,7 @@ const props = defineProps<{
: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
+ props.link || props.hasClick
})
"
>
@@ -24,5 +27,9 @@ const props = defineProps<{
:to="props.link"
class="absolute inset-0 z-10 focus-visible:outline-none"
/>
+