Skip to content

Commit

Permalink
fix: improve ux
Browse files Browse the repository at this point in the history
  • Loading branch information
supersonictw committed Nov 14, 2024
1 parent 354dd35 commit 7f7f6ee
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 41 deletions.
21 changes: 13 additions & 8 deletions src/views/RoomCreateView.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<template>
<div>
<div :style="backgroundStyle" />
<div class="absolute top-36 flex w-full justify-center">
<div :style="backgroundStyle">
<div
class="flex flex-wrap w-full justify-center py-20"
:class="backdropClass"
>
<div
v-if="step === 1"
class="w-full md:w-2/3 mx-3 my-5 py-4 px-8 bg-white shadow-lg rounded-lg"
Expand Down Expand Up @@ -228,11 +230,14 @@ const roomData = reactive({
const backgroundStyle = computed(() => {
const {backgroundImage} = roomData;
return {
"backgroundImage": `url(${backgroundImage})`,
"filter": "brightness(0.3)",
"height": "100vh",
};
return !!backgroundImage ? {
backgroundImage: `url(${backgroundImage})`,
} : {};
});
const backdropClass = computed(() => {
const {backgroundImage} = roomData;
return !!backgroundImage ? "backdrop-brightness-50" : "";
});
const onClickNext = () => {
Expand Down
2 changes: 1 addition & 1 deletion src/views/RoomListView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
:key="j"
class="border-gray-400 flex flex-row mb-2"
>
<div class="rounded-md flex flex-1 items-center p-4 border-2 mt-3 border-lime-400">
<div class="rounded-md flex flex-1 items-center p-4 border-2 mt-3 border-lime-400 justify-between">
<img
:alt="i.label"
:src="i.backgroundImage"
Expand Down
34 changes: 23 additions & 11 deletions src/views/RoomManageView.vue
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
<template>
<div>
<div :style="backgroundStyle" />
<div :style="backgroundStyle">
<div
v-if="isDead"
class="absolute top-36 flex flex-col w-full"
class="flex flex-wrap w-full justify-center bg-white py-20"
>
<div class="text-center text-red-500">
發生錯誤
</div>
</div>
<div
v-else-if="isLoad"
class="absolute top-36 flex flex-col w-full"
class="flex flex-wrap w-full justify-center bg-white py-20"
>
<div class="flex justify-center my-16">
<loading-circle-icon class="h-8 w-8 animate-spin text-lime-600" />
</div>
</div>
<div
v-else
class="absolute top-36 flex w-full justify-center"
class="flex flex-wrap w-full justify-center py-20"
:class="backdropClass"
>
<div class="max-w-md py-4 px-8 bg-white shadow-lg rounded-lg my-20">
<div class="flex justify-center md:justify-end -mt-16">
Expand Down Expand Up @@ -143,17 +143,29 @@ const inviteUrl = computed(() => {
});
const descriptionHtml = computed(() => {
const escapeMap = {
"&": "&amp;",
"<": "&lt;",
">": "&gt;",
"\"": "&quot;",
"'": "&#039;",
};
const {description} = roomData;
return description?.replaceAll("\n", "<br />");
return description?.
replace(/[&<>"']/g, (i) => escapeMap[i]).
replaceAll("\n", "<br />");
});
const backgroundStyle = computed(() => {
const {backgroundImage} = roomData;
return {
"backgroundImage": `url(${backgroundImage})`,
"filter": "brightness(0.3)",
"height": "100vh",
};
return !!backgroundImage ? {
backgroundImage: `url(${backgroundImage})`,
} : {};
});
const backdropClass = computed(() => {
const {backgroundImage} = roomData;
return !!backgroundImage ? "backdrop-brightness-50" : "";
});
const onClickCopyInviteUrl = async () => {
Expand Down
23 changes: 13 additions & 10 deletions src/views/RoomSubmissionView.vue
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
<template>
<div>
<div :style="backgroundStyle" />
<div :style="backgroundStyle">
<div
v-if="isDead"
class="absolute top-36 flex flex-col w-full"
class="flex flex-wrap w-full justify-center bg-white py-20"
>
<div class="text-center text-red-500">
發生錯誤
</div>
</div>
<div
v-else-if="isLoad"
class="absolute top-36 flex flex-col w-full"
class="flex flex-wrap w-full justify-center bg-white py-20"
>
<div class="flex justify-center my-16">
<loading-circle-icon class="h-8 w-8 animate-spin text-lime-600" />
</div>
</div>
<div
v-else
class="absolute top-36 flex flex-col w-full justify-start"
class="flex flex-wrap w-full justify-center py-20"
:class="backdropClass"
>
<div class="w-full flex justify-center">
<div class="max-w-md py-4 px-8 bg-white shadow-lg rounded-lg mt-20 mb-8">
Expand Down Expand Up @@ -183,11 +183,14 @@ const isValid = computed(() => {
const backgroundStyle = computed(() => {
const {backgroundImage} = roomData;
return {
"backgroundImage": `url(${backgroundImage})`,
"filter": "brightness(0.3)",
"height": "100vh",
};
return !!backgroundImage ? {
backgroundImage: `url(${backgroundImage})`,
} : {};
});
const backdropClass = computed(() => {
const {backgroundImage} = roomData;
return !!backgroundImage ? "backdrop-brightness-50" : "";
});
watch(submissionCode, (v) => {
Expand Down
34 changes: 23 additions & 11 deletions src/views/TicketView.vue
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
<template>
<div>
<div :style="backgroundStyle" />
<div :style="backgroundStyle">
<div
v-if="isDead"
class="absolute top-36 flex flex-col w-full"
class="flex flex-wrap w-full justify-center bg-white py-20"
>
<div class="text-center text-red-500">
發生錯誤
</div>
</div>
<div
v-else-if="isLoad"
class="absolute top-36 flex flex-col w-full"
class="flex flex-wrap w-full justify-center bg-white py-20"
>
<div class="flex justify-center my-16">
<loading-circle-icon class="h-8 w-8 animate-spin text-lime-600" />
</div>
</div>
<div
v-else
class="absolute top-36 flex w-full justify-center"
class="flex flex-wrap w-full justify-center py-20"
:class="backdropClass"
>
<div class="max-w-md py-4 px-8 bg-white shadow-lg rounded-lg my-20">
<div class="flex justify-center md:justify-end -mt-16">
Expand Down Expand Up @@ -145,17 +145,29 @@ const isSubmmited = computed(() => {
});
const descriptionHtml = computed(() => {
const escapeMap = {
"&": "&amp;",
"<": "&lt;",
">": "&gt;",
"\"": "&quot;",
"'": "&#039;",
};
const {description} = roomData;
return description?.replaceAll("\n", "<br />");
return description?.
replace(/[&<>"']/g, (i) => escapeMap[i]).
replaceAll("\n", "<br />");
});
const backgroundStyle = computed(() => {
const {backgroundImage} = roomData;
return {
"backgroundImage": `url(${backgroundImage})`,
"filter": "brightness(0.3)",
"height": "100vh",
};
return !!backgroundImage ? {
backgroundImage: `url(${backgroundImage})`,
} : {};
});
const backdropClass = computed(() => {
const {backgroundImage} = roomData;
return !!backgroundImage ? "backdrop-brightness-50" : "";
});
const onClickCopy = async () => {
Expand Down

0 comments on commit 7f7f6ee

Please sign in to comment.