Skip to content

Commit

Permalink
refactor: optimize ux
Browse files Browse the repository at this point in the history
  • Loading branch information
supersonictw committed Oct 21, 2024
1 parent 9507c24 commit b4f5fd6
Show file tree
Hide file tree
Showing 6 changed files with 147 additions and 67 deletions.
43 changes: 42 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,54 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Sara - Web Tech TW</title>
<link rel="icon" href="/favicon.ico">
<style>
.js-required>div {
text-align: center;
font-family: sans-serif;
margin-top: 10px;
margin-bottom: 10px;
}

.js-required a {
text-decoration: none;
color: #007ace;
}

.js-required a:hover {
color: #005bcf;
}

.js-required .title {
font-size: 1em;
font-weight: bold;
}
</style>
</head>

<body>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
<noscript>
We"re sorry but sara doesn"t work properly without JavaScript enabled. Please enable it to continue.
<div class="js-required">
<div class="title">
Ahoy! It seems that JavaScript is disabled in your browser.
</div>
<div>
The application mandates the use of JavaScript for proper functionality,
for rendering content and ensuring a seamless user experience.
</div>
<div>
Please enable JavaScript in your browser settings and refresh the page to continue.
</div>
<div>
Thank you!
</div>
<div>
&copy; <a href="https://web-tech.tw" target="_blank">
Taiwan Web Technology Promotion Organization
</a>
</div>
</div>
</noscript>
</body>

Expand Down
36 changes: 25 additions & 11 deletions public/404.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8">
<meta content="IE=edge" http-equiv="X-UA-Compatible">
Expand All @@ -8,34 +9,47 @@
<link href="/favicon.ico" rel="icon">
<title>Not Found - Taiwan Web Technology Promotion Organization</title>
<style>
#app {
.modal {
font-family: "Roboto", sans-serif;
}

#app .modal {
margin: 30px 10%;
text-align: left;
}

#app .modal .action {
.modal .title {
font-size: 1.5em;
font-weight: bold;
}

.modal .action {
margin-top: 50px;
margin-bottom: 50px;
}

#app .modal a {
.modal a {
text-decoration: none;
color: #007ace;
}

.modal a:hover {
color: #005bcf;
}
</style>
</head>

<body>
<div id="app">
<div class="modal">
<h1>Page is not found.</h1>
<div class="title">
Page is not found.
</div>
<div class="action">
<a href="https://web-tech.tw">Go Home</a>
<a href="https://web-tech.tw">
Go Home
</a>
</div>
<div>
&copy; Taiwan Web Technology Promotion Organization
</div>
<p>&copy; Taiwan Web Technology Promotion Organization</p>
</div>
</div>
</body>

</html>
8 changes: 7 additions & 1 deletion src/components/CreateTokenRequest.vue
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,12 @@ const inputHistory = ref("");
const isLoad = ref(false);
const isDone = ref(false);
const isUsingPasskey = ref(false);
const isUsingEmailCode = ref(false);
const isShowPasskey = computed(() => {
return browserSupportsWebAuthn();
return browserSupportsWebAuthn() && !isUsingEmailCode.value;
});
const isShowClearHistory = computed(() => {
Expand Down Expand Up @@ -177,6 +179,8 @@ const requestSubmit = async (value) => {
const client = useClient();
try {
isUsingEmailCode.value = true;
const response = await client.post("tokens", {
json: {
email: value,
Expand Down Expand Up @@ -217,6 +221,8 @@ const requestSubmit = async (value) => {
emits("status", {
message: `發生錯誤 (${errorCode})`,
});
isUsingEmailCode.value = false;
}
};
Expand Down
117 changes: 68 additions & 49 deletions src/components/ManagePasskeyShow.vue
Original file line number Diff line number Diff line change
@@ -1,64 +1,83 @@
<template>
<div class="flex justify-center my-8 py-16">
<div class="flex flex-col mx-auto">
<div class="max-w-2xl mx-auto sm:px-6 lg:px-8">
<div class="overflow-hidden shadow-md">
<div class="p-6 bg-white border-b border-gray-200">
<div>ID: {{ props.id }}</div>
<div>Label: {{ props.label }}</div>
<div>Public Key: {{ props.publicKey }}</div>
<div>Counter: {{ props.counter }}</div>
<div>Transports: {{ props.transports }}</div>
<div>Created At: {{ props.createdAt }}</div>
<div>Updated At: {{ props.updatedAt }}</div>
</div>
</div>
<div class="p-6 bg-white border-gray-200 text-right">
<button
class="bg-white-500 shadow-md text-sm text-black font-bold py-3 md:px-8 px-4 hover:bg-slate-100 rounded"
@click="onClickCancel"
>
取消
</button>
</div>
<div class="px-6 py-4 bg-white border-b border-gray-200 font-bold">
Passkey 通行金鑰 — {{ props.label }}
</div>
<div class="p-6 bg-white border-b border-gray-200">
<span class="text-gray-600">金鑰識別碼: </span>{{ props.id }}<br>
<span class="text-gray-600">使用次數*: </span>{{ props.counter }}<br>
<span class="text-gray-600">傳輸機制: </span>{{ props.transports.join(", ") }}<br>
<span class="text-gray-600">建立時間: </span>{{ props.createdAt }}<br>
<span class="text-gray-600">更新時間: </span>{{ props.updatedAt }}<br>
</div>
<div class="p-6 bg-white border-b border-gray-200 text-sm text-gray-600">
* 對於 Apple Inc. 所生產的裝置,
基於該製造商對於 Passkey 通行金鑰的設計,
使用次數僅供參考(可能永久為 0),
實際使用次數可能因為 Apple Inc. 的實作方式而有所不同。
</div>
<div class="p-6 bg-white border-gray-200 text-right">
<button
class="bg-sky-500 shadow-md text-sm text-white font-bold py-3 md:px-8 px-4 hover:bg-sky-600 rounded mr-3"
@click="onClickEdit"
>
修改
</button>
<button
class="bg-white-500 shadow-md text-sm text-black font-bold py-3 md:px-8 px-4 hover:bg-slate-100 rounded"
@click="onClickCancel"
>
返回
</button>
</div>
</div>
</div>
</template>

<script setup>
const props = defineProps({
id: {
type: String,
required: true,
},
label: {
type: String,
required: true,
},
publicKey: {
type: String,
required: true,
},
counter: {
type: Number,
required: true,
},
transports: {
type: Array,
required: true,
},
createdAt: {
type: String,
required: true,
},
updatedAt: {
type: String,
required: true,
},
id: {
type: String,
required: true,
},
label: {
type: String,
required: true,
},
publicKey: {
type: String,
required: true,
},
counter: {
type: Number,
required: true,
},
transports: {
type: Array,
required: true,
},
createdAt: {
type: String,
required: true,
},
updatedAt: {
type: String,
required: true,
},
});
const emits = defineEmits(["state", "status"]);
const onClickEdit = () => {
emits("status", {
message: "尚未實作",
});
};
const onClickCancel = () => {
location.reload();
emits("state", {
name: "ManageProfileShow",
});
};
</script>
2 changes: 1 addition & 1 deletion src/components/ManageProfileShow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<button
v-for="(i, j) in myProfile.passkeys"
:key="j"
class="w-full bg-white shadow-md text-sm text-slate-700 font-bold py-3 md:px-8 px-4 my-1 hover:bg-slate-300 rounded"
class="w-full bg-white text-sm text-slate-700 font-bold py-3 md:px-8 px-4 my-1 hover:bg-slate-300 rounded"
@click="onClickPasskeyManage(i)"
>
{{ i.label }}
Expand Down
8 changes: 4 additions & 4 deletions src/views/NotFoundView.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<template>
<div class="mt-10 mx-auto py-10 max-w-7xl px-4 sm:mt-12 sm:px-6 md:mt-16 lg:mt-20 lg:px-8 xl:mt-28">
<div class="mt-10 mx-auto py-10 max-w-7xl px-12">
<div class="sm:text-center lg:text-left">
<h1 class="text-4xl tracking-tight font-extrabold text-gray-900 sm:text-5xl md:text-6xl">
<span class="block text-amber-600 xl:inline">404</span>
<h1 class="text-4xl tracking-tight font-bold text-gray-900">
<span class="block text-amber-600 xl:inline md:mr-3">404</span>
<span class="block xl:inline">頁面不存在</span>
</h1>
<p class="mt-3 text-base text-gray-500 sm:mt-5 sm:text-lg sm:max-w-xl sm:mx-auto md:mt-5 md:text-xl lg:mx-0">
您所請求的頁面不見了,或者是從來沒有存在過。
</p>
<div class="mt-5 sm:mt-8 sm:flex sm:justify-center lg:justify-start">
<div class="mt-5 sm:mt-16 sm:flex sm:justify-center lg:justify-start">
<div class="mt-3 sm:mt-0 sm:ml-3">
<router-link
class="w-full flex items-center justify-center px-8 py-3 border border-transparent text-base font-medium rounded-md text-amber-700 bg-amber-100 hover:bg-amber-200 md:py-4 md:text-lg md:px-10"
Expand Down

0 comments on commit b4f5fd6

Please sign in to comment.