Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ui/ux): auth pages #1161

Merged
merged 5 commits into from
May 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion desk/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<router-view />
<router-view class="antialiased" />
<Toasts />
<KeymapDialog />
</template>
Expand Down
5 changes: 5 additions & 0 deletions desk/src/assets/logos/helpdesk.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 9 additions & 9 deletions desk/src/components/global/LoginBox.vue
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<template>
<div class="flex h-screen w-screen items-center justify-center">
<div class="rounded-xl shadow-xl">
<div
class="flex h-screen w-screen flex-col items-center justify-center bg-gray-50"
>
<div class="mb-8">
<img
v-if="configStore.brandLogo"
:src="configStore.brandLogo"
class="m-auto h-6"
class="m-auto h-8"
/>
<div v-else class="flex">
<div class="mx-auto h-6 w-auto">
<CustomIcons name="frappedesk" class="h-6" />
</div>
</div>
<Logo v-else class="mx-auto h-8" />
</div>
<div class="rounded-xl bg-white shadow-xl">
<div class="w-96 py-8 px-10">
<div class="mb-6 text-center text-lg">
{{ title }}
Expand All @@ -23,7 +23,7 @@

<script setup lang="ts">
import { useConfigStore } from "@/stores/config";
import CustomIcons from "@/components/desk/global/CustomIcons.vue";
import Logo from "~icons/logos/helpdesk";

defineProps({
title: {
Expand Down
2 changes: 1 addition & 1 deletion desk/src/pages/auth/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
label="Email"
:type="email !== 'Administrator' ? 'email' : 'text'"
v-model="email"
placeholder="johndeo@gmail.com"
placeholder="johndoe@gmail.com"
/>
<Input
v-if="!forgot"
Expand Down
3 changes: 0 additions & 3 deletions desk/src/pages/auth/Signup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,15 @@
label="First Name"
type="text"
placeholder="John"
class="mb-4"
required
/>
<Input
v-model="lastName"
label="Last Name"
type="text"
placeholder="Doe"
class="mb-4"
required
/>
<ErrorMessage class="mt-4" error="" />
<div>
<Button
appearance="primary"
Expand Down
18 changes: 14 additions & 4 deletions desk/src/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ export const VERIFY = "Verify Account";
export const AGENT_PORTAL_LANDING = "DeskTickets";
export const CUSTOMER_PORTAL_LANDING = "PortalTickets";
export const CUSTOMER_PORTAL_NEW_TICKET = "DefaultNewTicket";
export const AUTH_BYPASS_ROUTES = [LOGIN, SIGNUP, VERIFY];
export const AUTH_ROUTES = [LOGIN, SIGNUP, VERIFY];
export const KNOWLEDGE_BASE_PUBLIC = "Knowledge Base";
export const WEBSITE_ROOT = "Website Root";

const routes = [
{
path: "",
name: WEBSITE_ROOT,
component: () => import("@/pages/WebsiteRoot.vue"),
},
{
Expand Down Expand Up @@ -380,9 +382,17 @@ router.beforeEach(async (to) => {
});

router.beforeEach(async (to) => {
if (AUTH_BYPASS_ROUTES.includes(to.name)) return;

const isAuthRoute = AUTH_ROUTES.includes(to.name);
const authStore = useAuthStore();

await authStore.init().catch(() => router.replace({ name: LOGIN }));
try {
await authStore.init();
if (isAuthRoute) {
router.replace({ name: WEBSITE_ROOT });
}
} catch {
if (!isAuthRoute) {
router.replace({ name: LOGIN });
}
}
});
5 changes: 5 additions & 0 deletions desk/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ export default defineConfig({

return r.toMinifiedString();
}),
logos: FileSystemIconLoader("./src/assets/logos", async (svg) => {
const r = new SVG(svg);
await cleanupSVG(r);
return r.toMinifiedString();
}),
},
}),
],
Expand Down