big ui refractor
This commit is contained in:
1186
client/package-lock.json
generated
1186
client/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -48,6 +48,7 @@
|
||||
"stylelint": "^16.26.1",
|
||||
"stylelint-config-recommended-vue": "^1.6.1",
|
||||
"stylelint-config-standard-scss": "^16.0.0",
|
||||
"vite-plugin-vue-devtools": "^8.0.5",
|
||||
"vue-eslint-parser": "^10.2.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,27 @@
|
||||
<template lang="pug">
|
||||
v-app.zen-app
|
||||
v-app.zen-app.overflow-hidden
|
||||
.parallax-bg(
|
||||
:style="parallaxStyle"
|
||||
:class="{ 'zooming': viewState === 'zooming' }"
|
||||
)
|
||||
.bg-gradient
|
||||
.bg-grid
|
||||
|
||||
.kanji-layer
|
||||
span.bg-kanji(
|
||||
v-for="(k, i) in backgroundKanjis"
|
||||
:key="i"
|
||||
:style="k.style"
|
||||
) {{ k.char }}
|
||||
|
||||
.orb.orb-1(:class="{ 'zooming': viewState === 'zooming' }")
|
||||
.orb.orb-2(:class="{ 'zooming': viewState === 'zooming' }")
|
||||
.orb.orb-3(:class="{ 'zooming': viewState === 'zooming' }")
|
||||
|
||||
.app-content-wrapper(
|
||||
v-if="store.token || viewState === 'zooming'"
|
||||
:class="{ 'app-entering': viewState === 'zooming', 'app-visible': viewState === 'app' }"
|
||||
)
|
||||
v-navigation-drawer(
|
||||
v-model="drawer"
|
||||
temporary
|
||||
@@ -78,14 +100,12 @@
|
||||
.d-none.d-md-flex.align-center
|
||||
v-btn.mx-1(
|
||||
to="/"
|
||||
:active="false"
|
||||
variant="text"
|
||||
:color="$route.path === '/' ? '#00cec9' : 'grey'"
|
||||
) {{ $t('nav.dashboard') }}
|
||||
|
||||
v-btn.mx-1(
|
||||
to="/collection"
|
||||
:active="false"
|
||||
variant="text"
|
||||
:color="$route.path === '/collection' ? '#00cec9' : 'grey'"
|
||||
) {{ $t('nav.collection') }}
|
||||
@@ -131,13 +151,21 @@
|
||||
@click="drawer = !drawer"
|
||||
)
|
||||
|
||||
v-main
|
||||
.fill-height.d-flex.align-center.justify-center.px-4(v-if="!store.token")
|
||||
v-card.pa-6.rounded-lg.elevation-10.text-center.border-subtle(
|
||||
v-main.fill-height
|
||||
router-view(v-slot="{ Component }")
|
||||
transition(name="page" mode="out-in")
|
||||
component(:is="Component")
|
||||
|
||||
.login-overlay(
|
||||
v-if="!store.token || viewState === 'zooming' || viewState === 'authenticating'"
|
||||
:class="{ 'zooming': viewState === 'zooming' }"
|
||||
)
|
||||
v-card.login-card.pa-6.rounded-lg.elevation-10.text-center.border-subtle(
|
||||
color="#1e1e24"
|
||||
width="100%"
|
||||
max-width="400"
|
||||
)
|
||||
.login-content
|
||||
img.mb-4(:src="logo" height="64" width="64")
|
||||
|
||||
h1.text-h5.font-weight-bold.mb-2 {{ $t('hero.welcome') }}
|
||||
@@ -151,7 +179,8 @@
|
||||
color="white"
|
||||
hide-details
|
||||
density="comfortable"
|
||||
@keyup.enter="handleLogin"
|
||||
@keyup.enter="triggerLogin"
|
||||
:disabled="viewState === 'authenticating' || viewState === 'zooming'"
|
||||
)
|
||||
|
||||
v-alert.mb-4.text-left.text-caption(
|
||||
@@ -161,16 +190,14 @@
|
||||
variant="tonal"
|
||||
) {{ errorMsg }}
|
||||
|
||||
v-btn.text-black.font-weight-bold.mt-4(
|
||||
v-btn.text-black.font-weight-bold.mt-4.login-btn(
|
||||
block
|
||||
color="#00cec9"
|
||||
height="44"
|
||||
:loading="loggingIn"
|
||||
@click="handleLogin"
|
||||
:loading="viewState === 'authenticating'"
|
||||
@click="triggerLogin"
|
||||
) {{ $t('login.button') }}
|
||||
|
||||
router-view(v-else)
|
||||
|
||||
v-dialog(v-model="showSettings" max-width="340")
|
||||
v-card.rounded-xl.pa-4.border-subtle(color="#1e1e24")
|
||||
v-card-title.text-center.font-weight-bold {{ $t('settings.title') }}
|
||||
@@ -205,15 +232,15 @@
|
||||
span {{ $t('settings.loose') }} (20)
|
||||
|
||||
.text-caption.text-grey.mb-2 {{ $t('settings.language') }}
|
||||
v-btn-toggle.d-flex.w-100.border-subtle(
|
||||
v-model="$i18n.locale"
|
||||
mandatory
|
||||
rounded="lg"
|
||||
color="#00cec9"
|
||||
)
|
||||
v-btn.flex-grow-1(value="en") EN
|
||||
v-btn.flex-grow-1(value="de") DE
|
||||
v-btn.flex-grow-1(value="ja") JA
|
||||
|
||||
.lang-switch-wrapper.border-subtle.mb-2
|
||||
.lang-glider(:style="{ transform: `translateX(${localeIndex * 100}%)` }")
|
||||
button.lang-btn(
|
||||
v-for="l in availableLocales"
|
||||
:key="l"
|
||||
:class="{ 'active': tempLocale === l }"
|
||||
@click="tempLocale = l"
|
||||
) {{ l.toUpperCase() }}
|
||||
|
||||
v-card-actions.mt-2
|
||||
v-btn.text-white(
|
||||
@@ -256,7 +283,9 @@
|
||||
|
||||
<script setup>
|
||||
/* eslint-disable no-unused-vars */
|
||||
import { ref, watch, onMounted } from 'vue';
|
||||
import {
|
||||
ref, watch, onMounted, computed, onUnmounted,
|
||||
} from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useAppStore } from '@/stores/appStore';
|
||||
import logo from '@/assets/icon.svg';
|
||||
@@ -265,8 +294,10 @@ const drawer = ref(false);
|
||||
const { locale, t } = useI18n();
|
||||
const store = useAppStore();
|
||||
|
||||
const viewState = ref('login');
|
||||
const mousePos = ref({ x: 0, y: 0 });
|
||||
|
||||
const inputKey = ref('');
|
||||
const loggingIn = ref(false);
|
||||
const syncing = ref(false);
|
||||
const errorMsg = ref('');
|
||||
const showSettings = ref(false);
|
||||
@@ -276,16 +307,114 @@ const snackbar = ref({ show: false, text: '', color: 'success' });
|
||||
const tempBatchSize = ref(store.batchSize);
|
||||
const tempDrawingAccuracy = ref(store.drawingAccuracy);
|
||||
|
||||
const availableLocales = ['en', 'de', 'ja'];
|
||||
const tempLocale = ref(locale.value);
|
||||
const localeIndex = computed(() => availableLocales.indexOf(tempLocale.value));
|
||||
|
||||
const backgroundKanjis = [
|
||||
{
|
||||
char: '禅',
|
||||
style: {
|
||||
top: '15%', left: '10%', fontSize: '8rem', opacity: 0.03,
|
||||
},
|
||||
},
|
||||
{
|
||||
char: '空',
|
||||
style: {
|
||||
top: '60%', left: '85%', fontSize: '10rem', opacity: 0.03,
|
||||
},
|
||||
},
|
||||
{
|
||||
char: '無',
|
||||
style: {
|
||||
top: '30%', left: '60%', fontSize: '12rem', opacity: 0.02,
|
||||
},
|
||||
},
|
||||
{
|
||||
char: '心',
|
||||
style: {
|
||||
top: '80%', left: '20%', fontSize: '6rem', opacity: 0.04,
|
||||
},
|
||||
},
|
||||
{
|
||||
char: '道',
|
||||
style: {
|
||||
top: '10%', left: '70%', fontSize: '5rem', opacity: 0.05,
|
||||
},
|
||||
},
|
||||
{
|
||||
char: '学',
|
||||
style: {
|
||||
top: '50%', left: '5%', fontSize: '4rem', opacity: 0.04,
|
||||
},
|
||||
},
|
||||
{
|
||||
char: '夢',
|
||||
style: {
|
||||
top: '90%', left: '60%', fontSize: '7rem', opacity: 0.03,
|
||||
},
|
||||
},
|
||||
{
|
||||
char: '力',
|
||||
style: {
|
||||
top: '25%', left: '35%', fontSize: '3rem', opacity: 0.05,
|
||||
},
|
||||
},
|
||||
{
|
||||
char: '月',
|
||||
style: {
|
||||
top: '75%', left: '90%', fontSize: '4rem', opacity: 0.04,
|
||||
},
|
||||
},
|
||||
{
|
||||
char: '水',
|
||||
style: {
|
||||
top: '40%', left: '80%', fontSize: '5rem', opacity: 0.03,
|
||||
},
|
||||
},
|
||||
{
|
||||
char: '火',
|
||||
style: {
|
||||
top: '70%', left: '50%', fontSize: '9rem', opacity: 0.02,
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
const handleMouseMove = (e) => {
|
||||
mousePos.value = {
|
||||
x: (e.clientX / window.innerWidth) * 2 - 1,
|
||||
y: (e.clientY / window.innerHeight) * 2 - 1,
|
||||
};
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
if (store.token) {
|
||||
viewState.value = 'app';
|
||||
store.fetchStats();
|
||||
} else {
|
||||
viewState.value = 'login';
|
||||
}
|
||||
window.addEventListener('mousemove', handleMouseMove);
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
window.removeEventListener('mousemove', handleMouseMove);
|
||||
});
|
||||
|
||||
const parallaxStyle = computed(() => {
|
||||
if (viewState.value === 'app') return {};
|
||||
const x = mousePos.value.x * -20;
|
||||
const y = mousePos.value.y * -20;
|
||||
return {
|
||||
transform: `translate(${x}px, ${y}px) scale(1.1)`,
|
||||
};
|
||||
});
|
||||
|
||||
watch(showSettings, (isOpen) => {
|
||||
if (isOpen) {
|
||||
tempBatchSize.value = store.batchSize;
|
||||
tempDrawingAccuracy.value = store.drawingAccuracy;
|
||||
tempLocale.value = locale.value;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -305,58 +434,223 @@ async function manualSync() {
|
||||
}
|
||||
}
|
||||
|
||||
async function handleLogin() {
|
||||
async function triggerLogin() {
|
||||
if (!inputKey.value) return;
|
||||
loggingIn.value = true;
|
||||
viewState.value = 'authenticating';
|
||||
errorMsg.value = '';
|
||||
|
||||
try {
|
||||
const result = await store.login(inputKey.value.trim());
|
||||
|
||||
// Wait for authentication state to settle
|
||||
setTimeout(() => {
|
||||
// Step 1: Start the zoom animation on the login card/background
|
||||
viewState.value = 'zooming';
|
||||
|
||||
// Step 2: Only after a significant part of the zoom has happened,
|
||||
// let the app content mount and start its own internal fade-in
|
||||
setTimeout(() => {
|
||||
viewState.value = 'app';
|
||||
if (result.user && !result.user.lastSync) {
|
||||
manualSync();
|
||||
}
|
||||
}, 1000); // Increased delay to ensure zoom is the primary visual focus first
|
||||
}, 800);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
errorMsg.value = e.message || t('login.failed');
|
||||
} finally {
|
||||
loggingIn.value = false;
|
||||
viewState.value = 'login';
|
||||
}
|
||||
}
|
||||
|
||||
function saveSettings() {
|
||||
showSettings.value = false;
|
||||
|
||||
setTimeout(() => {
|
||||
if (locale.value !== tempLocale.value) {
|
||||
locale.value = tempLocale.value;
|
||||
localStorage.setItem('zen_locale', locale.value);
|
||||
}
|
||||
|
||||
store.saveSettings({
|
||||
batchSize: tempBatchSize.value,
|
||||
drawingAccuracy: tempDrawingAccuracy.value,
|
||||
});
|
||||
|
||||
localStorage.setItem('zen_locale', locale.value);
|
||||
|
||||
showSettings.value = false;
|
||||
store.fetchQueue();
|
||||
}, 300);
|
||||
}
|
||||
|
||||
function handleLogout() {
|
||||
showLogoutDialog.value = true;
|
||||
drawer.value = false;
|
||||
}
|
||||
|
||||
function confirmLogout() {
|
||||
store.logout();
|
||||
inputKey.value = '';
|
||||
showLogoutDialog.value = false;
|
||||
viewState.value = 'login';
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" src="@/styles/pages/_app.scss"></style>
|
||||
<style lang="scss">
|
||||
.zen-app {
|
||||
position: relative;
|
||||
background-color: #121212 !important;
|
||||
}
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.safe-area-header {
|
||||
padding-top: env(safe-area-inset-top);
|
||||
.parallax-bg {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
z-index: 0;
|
||||
transition: transform 0.2s ease-out;
|
||||
background: radial-gradient(circle at 50% 50%, #1a1a20 0%, #0a0a0c 100%);
|
||||
overflow: hidden;
|
||||
|
||||
height: auto !important;
|
||||
&.zooming {
|
||||
transition: transform 1.2s cubic-bezier(0.7, 0, 0.3, 1);
|
||||
}
|
||||
|
||||
:deep(.v-toolbar__content) {
|
||||
min-height: 64px;
|
||||
.bg-grid {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background-image: radial-gradient(rgba(0, 206, 201, 0.15) 1px, transparent 1px);
|
||||
background-size: 40px 40px;
|
||||
opacity: 0.3;
|
||||
}
|
||||
|
||||
.kanji-layer {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
pointer-events: none;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.bg-kanji {
|
||||
position: absolute;
|
||||
color: rgba(255, 255, 255, 0.8);
|
||||
font-weight: 900;
|
||||
font-family: "Noto Serif JP", serif;
|
||||
user-select: none;
|
||||
pointer-events: none;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.orb {
|
||||
position: absolute;
|
||||
border-radius: 50%;
|
||||
filter: blur(80px);
|
||||
mix-blend-mode: screen;
|
||||
opacity: 0.6;
|
||||
animation: blob 10s infinite alternate;
|
||||
transition: all 1.2s ease-in-out;
|
||||
z-index: 0;
|
||||
|
||||
&.zooming {
|
||||
transform: scale(5);
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.orb-1 {
|
||||
top: 20%;
|
||||
left: 20%;
|
||||
width: 400px;
|
||||
height: 400px;
|
||||
background: rgba(0, 206, 201, 0.15);
|
||||
}
|
||||
|
||||
.orb-2 {
|
||||
top: 30%;
|
||||
right: 20%;
|
||||
width: 350px;
|
||||
height: 350px;
|
||||
background: rgba(162, 155, 254, 0.15);
|
||||
animation-delay: 2s;
|
||||
}
|
||||
|
||||
.orb-3 {
|
||||
bottom: 10%;
|
||||
left: 30%;
|
||||
width: 300px;
|
||||
height: 300px;
|
||||
background: rgba(30, 144, 255, 0.1);
|
||||
animation-delay: 4s;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes blob {
|
||||
0% {
|
||||
transform: translate(0, 0) scale(1);
|
||||
}
|
||||
|
||||
50% {
|
||||
transform: translate(30px, -50px) scale(1.1);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: translate(-20px, 20px) scale(0.9);
|
||||
}
|
||||
}
|
||||
|
||||
.login-overlay {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 50;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: all 1.2s cubic-bezier(0.7, 0, 0.3, 1);
|
||||
transform-origin: center center;
|
||||
|
||||
&.zooming {
|
||||
transform: scale(15);
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.login-card {
|
||||
position: relative;
|
||||
background: rgba(30, 30, 36, 0.6) !important;
|
||||
backdrop-filter: blur(20px);
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
|
||||
transition: transform 0.5s ease;
|
||||
|
||||
&:hover {
|
||||
transform: scale(1.01);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.app-content-wrapper {
|
||||
position: relative;
|
||||
z-index: 10;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
opacity: 0;
|
||||
transform: scale(0.95);
|
||||
filter: blur(10px);
|
||||
/* Increased blur for a smoother transition */
|
||||
transition: all 1.2s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
/* Match the zoom ease */
|
||||
pointer-events: none;
|
||||
/* Prevent clicks during transition */
|
||||
|
||||
&.app-entering {
|
||||
opacity: 0;
|
||||
/* Keep hidden initially even if class is present */
|
||||
}
|
||||
|
||||
&.app-visible {
|
||||
opacity: 1;
|
||||
transform: scale(1);
|
||||
filter: none;
|
||||
pointer-events: auto;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template lang="pug">
|
||||
v-card.pa-4.widget-card.rounded-xl.border-subtle.d-flex.flex-column(
|
||||
v-card.pa-4.widget-card.rounded-xl.d-flex.flex-column(
|
||||
color="#1e1e24"
|
||||
flat
|
||||
)
|
||||
@@ -38,5 +38,3 @@ const props = defineProps({
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const hasHeader = computed(() => !!props.title || !!props.icon || !!props.subtitle);
|
||||
</script>
|
||||
|
||||
<style lang="scss" src="@/styles/components/_widgets.scss" scoped></style>
|
||||
|
||||
@@ -35,5 +35,3 @@ const accuracyPercent = computed(() => {
|
||||
return Math.round((props.accuracy.correct / props.accuracy.total) * 100);
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" src="@/styles/components/_widgets.scss" scoped></style>
|
||||
|
||||
@@ -59,5 +59,3 @@ const toRoman = (num) => {
|
||||
return lookup[num] || num;
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" src="@/styles/components/_widgets.scss" scoped></style>
|
||||
|
||||
@@ -29,5 +29,3 @@ const props = defineProps({
|
||||
|
||||
const hasUpcoming = computed(() => props.forecast && props.forecast.some((c) => c > 0));
|
||||
</script>
|
||||
|
||||
<style lang="scss" src="@/styles/components/_widgets.scss" scoped></style>
|
||||
|
||||
@@ -35,5 +35,3 @@ const props = defineProps({
|
||||
ghosts: { type: Array, default: () => [] },
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" src="@/styles/components/_widgets.scss" scoped></style>
|
||||
|
||||
@@ -39,5 +39,3 @@ const masteryPercent = computed(
|
||||
() => (totalItems.value === 0 ? 0 : Math.round((masteredCount.value / totalItems.value) * 100)),
|
||||
);
|
||||
</script>
|
||||
|
||||
<style lang="scss" src="@/styles/components/_widgets.scss" scoped></style>
|
||||
|
||||
@@ -78,5 +78,3 @@ const getHeatmapClass = (count) => {
|
||||
const formatDate = (dateStr) => new Date(dateStr).toLocaleDateString(locale.value, { month: 'short', day: 'numeric' });
|
||||
const isToday = (dateStr) => dateStr === new Date().toISOString().split('T')[0];
|
||||
</script>
|
||||
|
||||
<style lang="scss" src="@/styles/components/_widgets.scss" scoped></style>
|
||||
|
||||
@@ -58,5 +58,3 @@ const getDayLabel = (dateStr) => {
|
||||
return new Date(dateStr).toLocaleDateString(locale.value, { weekday: 'short' });
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" src="@/styles/components/_widgets.scss" scoped></style>
|
||||
|
||||
@@ -1,53 +1,72 @@
|
||||
<template lang="pug">
|
||||
.grid-area-full.text-center.mb-4
|
||||
.text-h2.font-weight-bold.mb-2 {{ $t('hero.welcome') }}
|
||||
.text-h5.text-grey.mb-8 {{ $t('hero.subtitle') }}
|
||||
.grid-area-full.text-center.mb-8.zen-wrapper
|
||||
.text-h3.font-weight-bold.mb-2.text-white.letter-spacing-small {{ $t('hero.welcome') }}
|
||||
.text-subtitle-1.text-grey-lighten-1.mb-10(
|
||||
style="max-width: 600px; margin-inline: auto;"
|
||||
) {{ $t('hero.subtitle') }}
|
||||
|
||||
.d-flex.justify-center.align-center.flex-column.gap-4
|
||||
v-btn.text-h5.font-weight-bold.text-black.glow-btn.welcome-btn(
|
||||
.d-flex.justify-center.align-stretch.flex-wrap.ga-6.mb-8
|
||||
|
||||
v-btn.zen-btn.lesson-btn(
|
||||
v-if="lessonCount > 0"
|
||||
to="/lesson"
|
||||
rounded="xl"
|
||||
color="purple-accent-2"
|
||||
class="mb-3"
|
||||
variant="tonal"
|
||||
size="x-large"
|
||||
height="80"
|
||||
)
|
||||
v-icon(size="32" start) mdi-school
|
||||
.d-flex.align-center.w-100.px-2.zen-btn-content
|
||||
v-icon.mr-5(size="36" icon="mdi-school-outline")
|
||||
|
||||
.d-flex.flex-column.align-start.mr-auto
|
||||
.text-purple-lighten-1.text-h6.font-weight-bold.line-height-tight
|
||||
| {{ $t('hero.lessons') }}
|
||||
v-chip.ml-3.font-weight-bold(
|
||||
color="#1e1e24"
|
||||
variant="flat"
|
||||
size="default"
|
||||
style="color: white !important;"
|
||||
) {{ lessonCount }}
|
||||
v-btn.text-h5.font-weight-bold.text-black.glow-btn.welcome-btn(
|
||||
.text-purple-accent-1.text-caption.font-weight-regular.opacity-80
|
||||
| {{ $t('hero.newContent') }}
|
||||
|
||||
.zen-counter.bg-purple-accent-2.text-black.ml-4
|
||||
| {{ lessonCount }}
|
||||
|
||||
v-btn.zen-btn.review-btn(
|
||||
@click="$emit('start', 'shuffled')"
|
||||
rounded="xl"
|
||||
color="#00cec9"
|
||||
color="cyan-accent-2"
|
||||
variant="tonal"
|
||||
size="x-large"
|
||||
height="80"
|
||||
:disabled="queueLength === 0"
|
||||
:class="{ 'zen-disabled': queueLength === 0 }"
|
||||
)
|
||||
v-icon(size="32" start) mdi-brush
|
||||
| {{ queueLength > 0 ? $t('hero.start') : $t('hero.noReviews') }}
|
||||
.d-flex.align-center.w-100.px-2.zen-btn-content
|
||||
v-icon.mr-5(size="36" icon="mdi-brush-variant")
|
||||
|
||||
v-chip.ml-3.font-weight-bold(
|
||||
v-if="queueLength > 0"
|
||||
color="#1e1e24"
|
||||
variant="flat"
|
||||
size="default"
|
||||
style="color: white !important;"
|
||||
) {{ queueLength }}
|
||||
.d-flex.flex-column.align-start.mr-auto
|
||||
.text-cyan-lighten-1.text-h6.font-weight-bold.line-height-tight
|
||||
| {{ queueLength > 0 ? $t('hero.start') : $t('hero.noReviews') }}
|
||||
.text-cyan-accent-1.text-caption.font-weight-regular.opacity-80
|
||||
| {{ queueLength > 0 ? $t('hero.readyToReview') : $t('hero.allCaughtUp') }}
|
||||
|
||||
v-fade-transition
|
||||
v-btn.mt-4.text-caption.font-weight-bold(
|
||||
.zen-counter.bg-cyan-accent-2.text-black.ml-4(v-if="queueLength > 0")
|
||||
| {{ queueLength }}
|
||||
|
||||
.d-flex.justify-center.align-center.flex-column.gap-1
|
||||
v-fade-transition
|
||||
v-btn.text-caption.font-weight-bold.text-uppercase.letter-spacing-1.text-grey(
|
||||
v-if="hasLowerLevels"
|
||||
@click="$emit('start', 'priority')"
|
||||
variant="plain"
|
||||
color="grey-lighten-1"
|
||||
variant="text"
|
||||
prepend-icon="mdi-sort-ascending"
|
||||
:ripple="false"
|
||||
) {{ $t('hero.prioritize', { count: lowerLevelCount }) }}
|
||||
|
||||
.text-caption.text-grey.mt-2(v-if="queueLength === 0")
|
||||
| {{ $t('hero.nextIn') }} {{ nextReviewTime }}
|
||||
v-fade-transition
|
||||
.text-caption.text-grey-darken-1.font-weight-medium.d-flex.align-center.mt-2(
|
||||
v-if="queueLength === 0 && !hasLowerLevels && nextReviewTime"
|
||||
)
|
||||
v-icon.mr-2(size="small" icon="mdi-clock-outline")
|
||||
span {{ $t('hero.nextIn') }} {{ nextReviewTime }}
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
@@ -67,9 +86,11 @@ defineEmits(['start']);
|
||||
const { t } = useI18n();
|
||||
|
||||
const nextReviewTime = computed(() => {
|
||||
if (!props.forecast) return 'a while';
|
||||
if (!props.forecast || Object.keys(props.forecast).length === 0) return null;
|
||||
try {
|
||||
const idx = props.forecast.findIndex((c) => c > 0);
|
||||
if (idx === -1) return 'a while';
|
||||
if (idx === -1) return null;
|
||||
return idx === 0 ? t('hero.now') : t('stats.inHours', { n: idx }, idx);
|
||||
} catch (e) { return null; }
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -121,6 +121,7 @@ watch(() => props.char, (newChar) => {
|
||||
|
||||
watch(() => props.autoHint, (shouldHint) => {
|
||||
if (!controller) return;
|
||||
controller.setAutoHint(shouldHint);
|
||||
if (shouldHint) controller.showHint();
|
||||
});
|
||||
|
||||
|
||||
@@ -58,6 +58,7 @@ const props = defineProps({
|
||||
default: 'animate',
|
||||
validator: (v) => ['hero', 'animate'].includes(v),
|
||||
},
|
||||
svgContent: { type: String, default: '' },
|
||||
});
|
||||
|
||||
const strokes = ref([]);
|
||||
@@ -72,10 +73,14 @@ async function loadData(char) {
|
||||
const hex = char.charCodeAt(0).toString(16).padStart(5, '0');
|
||||
|
||||
try {
|
||||
let txt = props.svgContent;
|
||||
|
||||
if (!txt) {
|
||||
const baseUrl = 'https://raw.githubusercontent.com/KanjiVG/kanjivg/master/kanji';
|
||||
const res = await fetch(`${baseUrl}/${hex}.svg`);
|
||||
txt = await res.text();
|
||||
}
|
||||
|
||||
const txt = await res.text();
|
||||
const parser = new DOMParser();
|
||||
const doc = parser.parseFromString(txt, 'image/svg+xml');
|
||||
const rawPaths = Array.from(doc.getElementsByTagName('path')).map((p) => p.getAttribute('d'));
|
||||
@@ -147,5 +152,3 @@ defineExpose({ playAnimation });
|
||||
onMounted(() => { if (props.char) loadData(props.char); });
|
||||
watch(() => props.char, (n) => { if (n) loadData(n); });
|
||||
</script>
|
||||
|
||||
<style lang="scss" src="@/styles/components/_kanji.scss" scoped></style>
|
||||
|
||||
@@ -50,10 +50,13 @@ const messages = {
|
||||
},
|
||||
hero: {
|
||||
lessons: 'Lessons',
|
||||
newContent: 'New content available',
|
||||
welcome: 'Welcome Back',
|
||||
subtitle: 'Your mind is ready.',
|
||||
start: 'Start Review',
|
||||
readyToReview: 'Ready to review',
|
||||
noReviews: 'No Reviews',
|
||||
allCaughtUp: 'All caught up',
|
||||
nextIn: 'Next review in',
|
||||
now: 'now',
|
||||
prioritize: 'Prioritize Lower Levels ({count})',
|
||||
@@ -177,10 +180,13 @@ const messages = {
|
||||
},
|
||||
hero: {
|
||||
lessons: 'Lektionen',
|
||||
newContent: 'Neue Inhalte verfügbar',
|
||||
welcome: 'Willkommen zurück',
|
||||
subtitle: 'Dein Geist ist bereit.',
|
||||
start: 'Starten',
|
||||
readyToReview: 'Bereit zum Wiederholen',
|
||||
noReviews: 'Alles erledigt',
|
||||
allCaughtUp: 'Alles auf dem neuesten Stand',
|
||||
nextIn: 'Nächste Review in',
|
||||
now: 'jetzt',
|
||||
prioritize: 'Niedrige Stufen zuerst ({count})',
|
||||
@@ -304,10 +310,13 @@ const messages = {
|
||||
},
|
||||
hero: {
|
||||
lessons: 'レッスン',
|
||||
newContent: '新しいコンテンツがあります',
|
||||
welcome: 'お帰りなさい',
|
||||
subtitle: '準備は完了です。',
|
||||
start: '復習開始',
|
||||
readyToReview: '復習の準備ができています',
|
||||
noReviews: 'レビューなし',
|
||||
allCaughtUp: 'すべて完了しています',
|
||||
nextIn: '次の復習まで',
|
||||
now: '今',
|
||||
prioritize: '低レベルを優先 ({count})',
|
||||
|
||||
@@ -41,7 +41,6 @@ export const useAppStore = defineStore('app', {
|
||||
this.batchSize = data.user.settings.batchSize || 20;
|
||||
this.drawingAccuracy = data.user.settings.drawingAccuracy || 10;
|
||||
|
||||
// Persist settings to local storage on login
|
||||
localStorage.setItem('zen_batch_size', this.batchSize);
|
||||
localStorage.setItem('zen_drawing_accuracy', this.drawingAccuracy);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
@forward 'variables/colors';
|
||||
@forward 'variables/typography';
|
||||
@forward 'variables/spacing';
|
||||
@forward 'variables/spacings';
|
||||
@forward 'variables/layout';
|
||||
@forward 'variables/effects';
|
||||
@forward 'mixins';
|
||||
@@ -13,12 +13,11 @@
|
||||
gap: $gap;
|
||||
}
|
||||
|
||||
@mixin grid-responsive($min-width: 960px) {
|
||||
@mixin grid-responsive($min-width: $breakpoint-md) {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr;
|
||||
|
||||
@media (min-width: $min-width) {
|
||||
// stylelint-disable-next-line no-invalid-position-declaration
|
||||
grid-template-columns: 1fr 1fr;
|
||||
}
|
||||
}
|
||||
@@ -26,7 +25,7 @@
|
||||
@mixin card-base {
|
||||
background: $color-surface-light;
|
||||
border-radius: $radius-md;
|
||||
border: 1px solid transparent;
|
||||
border: $border-width-sm solid transparent;
|
||||
background-clip: padding-box;
|
||||
}
|
||||
|
||||
@@ -40,7 +39,7 @@
|
||||
backface-visibility: hidden;
|
||||
|
||||
&:hover {
|
||||
transform: translateY(-2px);
|
||||
transform: translateY(-0.125rem);
|
||||
background: color.adjust($color-surface-light, $lightness: 5%);
|
||||
box-shadow: $shadow-md;
|
||||
}
|
||||
@@ -48,7 +47,7 @@
|
||||
|
||||
@mixin scrollbar {
|
||||
scrollbar-width: thin;
|
||||
scrollbar-color: #333 transparent;
|
||||
scrollbar-color: $color-stroke-inactive transparent;
|
||||
}
|
||||
|
||||
@mixin animate-fade-up($duration: 0.4s) {
|
||||
@@ -57,9 +56,8 @@
|
||||
@keyframes fade-slide-up {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(10px);
|
||||
transform: translateY(0.625rem);
|
||||
}
|
||||
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
|
||||
@@ -1,14 +1,35 @@
|
||||
$color-primary: hsl(178deg 100% 40%);
|
||||
$color-secondary: hsl(46deg 100% 82%);
|
||||
|
||||
$color-bg-dark: hsl(0deg 0% 7%);
|
||||
$color-surface: hsl(240deg 9% 13%);
|
||||
$color-surface-light: hsl(221deg 17% 22%);
|
||||
$color-surface-lighter: hsl(240deg 5% 16%);
|
||||
$color-zinc-900: hsl(240deg 6% 10%);
|
||||
|
||||
$color-text-white: hsl(0deg 0% 100%);
|
||||
$color-text-grey: hsl(213deg 14% 70%);
|
||||
$color-text-dark: hsl(0deg 0% 0%);
|
||||
|
||||
$color-border: hsl(0deg 0% 100% / 8%);
|
||||
$color-zinc-900: #18181b;
|
||||
$color-reading-box: rgb(255 255 255 / 3%);
|
||||
$color-stroke-drawn: #a1a1aa;
|
||||
$color-danger: hsl(0deg 85% 65%);
|
||||
$color-success: hsl(160deg 80% 45%);
|
||||
$color-warning: hsl(40deg 100% 50%);
|
||||
$color-info: hsl(210deg 100% 56%);
|
||||
|
||||
$color-reading-box: hsl(0deg 0% 100% / 3%);
|
||||
$color-stroke-drawn: hsl(240deg 5% 65%);
|
||||
$color-stroke-inactive: hsl(0deg 0% 33%);
|
||||
$color-dot-base: hsl(0deg 0% 27%);
|
||||
$color-zen-lesson: hsl(291deg 96% 62%);
|
||||
$color-zen-review: hsl(180deg 100% 55%);
|
||||
|
||||
$color-gold: hsl(51deg 100% 50%);
|
||||
$color-gold-glow: hsl(51deg 100% 50% / 50%);
|
||||
$color-gold-glow-strong: hsl(51deg 100% 50% / 60%);
|
||||
$color-gold-border: hsl(51deg 100% 50% / 30%);
|
||||
$color-overlay-white: hsl(0deg 0% 100% / 10%);
|
||||
|
||||
$color-srs-1: hsl(0deg 100% 73%);
|
||||
$color-srs-2: hsl(39deg 98% 71%);
|
||||
$color-srs-3: hsl(163deg 85% 64%);
|
||||
@@ -18,11 +39,8 @@ $color-srs-6: hsl(247deg 72% 63%);
|
||||
$color-srs-7: $color-primary;
|
||||
$color-srs-8: hsl(339deg 97% 73%);
|
||||
$color-srs-9: hsl(331deg 78% 59%);
|
||||
$color-srs-10: hsl(51deg 100% 50%);
|
||||
$color-danger: hsl(0deg 85% 65%);
|
||||
$color-success: hsl(160deg 80% 45%);
|
||||
$color-stroke-inactive: hsl(0deg 0% 33%);
|
||||
$color-dot-base: hsl(0deg 0% 27%);
|
||||
$color-srs-10: $color-gold;
|
||||
|
||||
$srs-colors: (
|
||||
1: $color-srs-1,
|
||||
2: $color-srs-2,
|
||||
|
||||
@@ -5,26 +5,39 @@ $opacity-disabled: 0.5;
|
||||
$opacity-inactive: 0.3;
|
||||
$opacity-hover: 0.8;
|
||||
$opacity-active: 1;
|
||||
$opacity-kanji-hint: 0.5;
|
||||
|
||||
$blur-sm: blur(4px);
|
||||
$blur-md: blur(10px);
|
||||
$blur-lg: blur(20px);
|
||||
|
||||
$bg-glass-subtle: hsl(0deg 0% 100% / 5%);
|
||||
$bg-glass-light: hsl(0deg 0% 100% / 6%);
|
||||
$bg-glass-strong: hsl(0deg 0% 100% / 10%);
|
||||
$bg-glass-dark: hsl(0deg 0% 0% / 20%);
|
||||
$shadow-sm: 0 2px 4px hsl(0deg 0% 0% / 20%);
|
||||
$shadow-md: 0 4px 15px hsl(0deg 0% 0% / 30%);
|
||||
$shadow-lg: 0 20px 50px hsl(0deg 0% 0% / 50%);
|
||||
$shadow-inset: inset 0 0 20px hsl(0deg 0% 0% / 30%);
|
||||
$text-shadow: 0 2px 10px hsl(0deg 0% 0% / 50%);
|
||||
$shadow-glow-xs: 0 0 4px hsl(0deg 0% 100% / 50%);
|
||||
$shadow-glow-base: 0 0 20px color.change($color-primary, $alpha: 0.4);
|
||||
$shadow-glow-hover: 0 0 40px color.change($color-primary, $alpha: 0.6);
|
||||
$shadow-glow-active: 0 0 20px color.change($color-primary, $alpha: 0.4);
|
||||
$dist-slide-sm: 10px;
|
||||
|
||||
$shadow-color-base: hsl(0deg 0% 0% / 20%);
|
||||
$shadow-color-dark: hsl(0deg 0% 0% / 30%);
|
||||
$shadow-color-darker: hsl(0deg 0% 0% / 50%);
|
||||
|
||||
$shadow-sm: 0 0.125rem 0.25rem $shadow-color-base;
|
||||
$shadow-md: 0 0.25rem 0.9375rem $shadow-color-dark;
|
||||
$shadow-lg: 0 1.25rem 3.125rem $shadow-color-darker;
|
||||
$shadow-inset: inset 0 0 1.25rem $shadow-color-dark;
|
||||
$text-shadow: 0 0.125rem 0.625rem $shadow-color-darker;
|
||||
|
||||
$shadow-glow-xs: 0 0 0.25rem hsl(0deg 0% 100% / 50%);
|
||||
$shadow-glow-base: 0 0 1.25rem color.change($color-primary, $alpha: 0.4);
|
||||
$shadow-glow-hover: 0 0 2.5rem color.change($color-primary, $alpha: 0.6);
|
||||
$shadow-glow-active: 0 0 1.25rem color.change($color-primary, $alpha: 0.4);
|
||||
|
||||
$shadow-srs-fill: 0 0 0.25rem hsl(0deg 0% 0% / 30%);
|
||||
|
||||
$dist-slide-sm: 0.625rem;
|
||||
$duration-fast: 0.2s;
|
||||
$duration-normal: 0.3s;
|
||||
$duration-slow: 0.5s;
|
||||
$duration-chart: 1s;
|
||||
|
||||
$ease-default: ease;
|
||||
$ease-out-back: cubic-bezier(0.175, 0.885, 0.32, 1.275);
|
||||
|
||||
5
client/src/styles/abstracts/variables/_index.scss
Normal file
5
client/src/styles/abstracts/variables/_index.scss
Normal file
@@ -0,0 +1,5 @@
|
||||
@forward 'colors';
|
||||
@forward 'typography';
|
||||
@forward 'spacings';
|
||||
@forward 'layout';
|
||||
@forward 'effects';
|
||||
@@ -1,54 +1,62 @@
|
||||
@use 'colors' as *;
|
||||
$max-width-desktop: 87.5rem;
|
||||
$max-width-heatmap: 59.375rem;
|
||||
$breakpoint-md: 60rem;
|
||||
$breakpoint-sm: 37.5rem;
|
||||
$breakpoint-xs: 25rem;
|
||||
|
||||
$radius-sm: 4px;
|
||||
$radius-md: 8px;
|
||||
$radius-lg: 12px;
|
||||
$radius-xl: 24px;
|
||||
$radius-pill: 999px;
|
||||
$padding-page-y: 2.5rem;
|
||||
$padding-page-x: 1.5rem;
|
||||
|
||||
$radius-xs: 0.125rem;
|
||||
$radius-sm: 0.25rem;
|
||||
$radius-md: 0.5rem;
|
||||
$radius-lg: 0.75rem;
|
||||
$radius-xl: 1.5rem;
|
||||
$radius-pill: 62.4375rem;
|
||||
$radius-circle: 50%;
|
||||
|
||||
$border-width-sm: 1px;
|
||||
$border-width-md: 2px;
|
||||
$border-subtle: $border-width-sm solid $color-border;
|
||||
$border-focus: $border-width-md solid $color-primary;
|
||||
$border-transparent: $border-width-md solid transparent;
|
||||
|
||||
$size-icon-btn: 2rem;
|
||||
$size-icon-small: 1.125rem;
|
||||
$size-avatar-small: 2rem;
|
||||
$size-card-min: 3.75rem;
|
||||
$size-loading-spinner: 4rem;
|
||||
|
||||
$size-heatmap-cell: 0.625rem;
|
||||
$size-legend-box: 0.75rem;
|
||||
$size-streak-dot: 1.5rem;
|
||||
$size-srs-track: 1.5rem;
|
||||
$size-srs-track-mobile: 0.375rem;
|
||||
$size-chart-height: 10rem;
|
||||
$size-ghost-min-height: 5rem;
|
||||
|
||||
$size-button-large-height: 4.375rem;
|
||||
$size-button-large-width: 17.5rem;
|
||||
$size-button-zen-height: 5rem;
|
||||
$size-zen-btn-max-width: 28.125rem;
|
||||
|
||||
$size-hero-wrapper: 8.75rem;
|
||||
$size-lesson-card-width: 28.125rem;
|
||||
$size-lesson-card-min-height: 31.25rem;
|
||||
$size-review-card-max-width: 26.25rem;
|
||||
|
||||
$size-canvas: 18.75rem;
|
||||
$size-kanji-preview: 12.5rem;
|
||||
$size-play-btn-offset: 0.625rem;
|
||||
|
||||
$stroke-width-main: 3px;
|
||||
$stroke-width-arrow: 2px;
|
||||
$stroke-width-kanji: 6px;
|
||||
|
||||
$z-back: -1;
|
||||
$z-normal: 1;
|
||||
$z-above: 2;
|
||||
$z-play-btn: 10;
|
||||
$z-sticky: 10;
|
||||
$z-dropdown: 50;
|
||||
$z-modal: 100;
|
||||
$z-tooltip: 200;
|
||||
$z-above: 2;
|
||||
|
||||
// Neue Z-Indizes aus dem Refactoring
|
||||
$z-play-btn: 10;
|
||||
$size-canvas: 300px;
|
||||
$size-kanji-preview: 200px;
|
||||
$size-icon-btn: 32px;
|
||||
$size-icon-small: 18px;
|
||||
$stroke-width-main: 3px;
|
||||
$stroke-width-arrow: 2px;
|
||||
$font-size-svg-number: 5px;
|
||||
$radius-xs: 2px;
|
||||
$size-legend-box: 12px;
|
||||
$size-streak-dot: 24px;
|
||||
$size-srs-track: 24px;
|
||||
$size-chart-height: 160px;
|
||||
$size-ghost-min-height: 80px;
|
||||
$max-width-heatmap: 950px;
|
||||
$max-width-desktop: 1400px;
|
||||
$padding-page-y: 40px;
|
||||
$padding-page-x: 24px;
|
||||
$breakpoint-md: 960px;
|
||||
$offset-fab: 20px;
|
||||
$size-heatmap-cell-height: 10px;
|
||||
$stroke-width-kanji: 6px;
|
||||
$opacity-kanji-hint: 0.5;
|
||||
$dash-kanji-hint: 10px 15px;
|
||||
|
||||
// --- NEUE VARIABLEN (Wichtig!) ---
|
||||
$size-hero-wrapper: 140px;
|
||||
$size-lesson-card-width: 450px;
|
||||
$size-lesson-card-min-height: 500px;
|
||||
$size-avatar-small: 32px;
|
||||
$size-button-large-height: 70px;
|
||||
$size-button-large-width: 280px;
|
||||
$offset-fab: 1.25rem;
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
$spacing-2xs: 2px;
|
||||
$spacing-xs: 4px;
|
||||
$spacing-sm: 8px;
|
||||
$spacing-md: 16px;
|
||||
$spacing-lg: 24px;
|
||||
$spacing-xl: 32px;
|
||||
$spacing-xxl: 48px;
|
||||
$size-loading-spinner: 64px;
|
||||
$gap-heatmap: 3px;
|
||||
$size-card-min: 60px;
|
||||
12
client/src/styles/abstracts/variables/_spacings.scss
Normal file
12
client/src/styles/abstracts/variables/_spacings.scss
Normal file
@@ -0,0 +1,12 @@
|
||||
$spacing-2xs: 0.125rem;
|
||||
$spacing-xs: 0.25rem;
|
||||
$spacing-sm: 0.5rem;
|
||||
$spacing-md: 1rem;
|
||||
$spacing-lg: 1.5rem;
|
||||
$spacing-xl: 2rem;
|
||||
$spacing-xxl: 3rem;
|
||||
$spacing-3xl: 4rem;
|
||||
|
||||
$gap-heatmap: 0.1875rem;
|
||||
$gap-srs-chart: 0.5rem;
|
||||
$gap-srs-chart-mobile: 0.25rem;
|
||||
@@ -4,6 +4,7 @@ $font-family-sans:
|
||||
-apple-system,
|
||||
sans-serif;
|
||||
$font-family-mono: 'Fira Code', monospace;
|
||||
|
||||
$font-xs: 0.75rem;
|
||||
$font-sm: 0.875rem;
|
||||
$font-md: 1rem;
|
||||
@@ -11,15 +12,22 @@ $font-lg: 1.25rem;
|
||||
$font-xl: 1.5rem;
|
||||
$font-2xl: 2rem;
|
||||
$font-3xl: 3rem;
|
||||
|
||||
$font-size-svg-number: 0.3125rem;
|
||||
$font-size-srs-label: 0.625rem;
|
||||
$font-size-heatmap-label: 0.5625rem;
|
||||
|
||||
$weight-regular: 400;
|
||||
$weight-medium: 500;
|
||||
$weight-bold: 700;
|
||||
$weight-black: 900;
|
||||
|
||||
$tracking-tighter: -0.05em;
|
||||
$tracking-tight: -0.025em;
|
||||
$tracking-normal: 0em;
|
||||
$tracking-wide: 0.025em;
|
||||
$tracking-wider: 0.05em;
|
||||
|
||||
$leading-tight: 1.2;
|
||||
$leading-normal: 1.5;
|
||||
$leading-loose: 1.8;
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
@use '../abstracts/variables' as *;
|
||||
@use '../abstracts' as *;
|
||||
|
||||
:root {
|
||||
--v-theme-background: #{$color-bg-dark};
|
||||
--color-background: #{$color-bg-dark};
|
||||
--color-surface: #{$color-surface};
|
||||
--color-primary: #{$color-primary};
|
||||
|
||||
@each $level, $color in $srs-colors {
|
||||
--srs-#{$level}: #{$color};
|
||||
@@ -16,31 +17,14 @@ html,
|
||||
background-color: $color-bg-dark !important;
|
||||
font-family: $font-family-sans;
|
||||
color: $color-text-white;
|
||||
}
|
||||
|
||||
.v-navigation-drawer {
|
||||
background-color: $color-surface !important;
|
||||
|
||||
// stylelint-disable-next-line selector-class-pattern
|
||||
.v-list-item--active {
|
||||
background-color: rgba($color-primary, 0.15);
|
||||
color: $color-primary !important;
|
||||
|
||||
.v-icon {
|
||||
color: $color-primary !important;
|
||||
}
|
||||
}
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
.v-card {
|
||||
box-shadow: $shadow-lg !important;
|
||||
}
|
||||
|
||||
.app-bar-blur {
|
||||
border-bottom-color: $color-border !important;
|
||||
backdrop-filter: $blur-md;
|
||||
}
|
||||
|
||||
.cursor-pointer {
|
||||
cursor: pointer;
|
||||
}
|
||||
@@ -54,15 +38,7 @@ html,
|
||||
}
|
||||
|
||||
.border-subtle {
|
||||
border: $border-subtle;
|
||||
}
|
||||
|
||||
.logo-hover {
|
||||
transition: opacity $duration-fast $ease-default;
|
||||
|
||||
&:hover {
|
||||
opacity: $opacity-hover;
|
||||
}
|
||||
border: $border-width-sm solid $color-border;
|
||||
}
|
||||
|
||||
@each $level, $color in $srs-colors {
|
||||
@@ -74,3 +50,20 @@ html,
|
||||
background-color: var(--srs-#{$level}) !important;
|
||||
}
|
||||
}
|
||||
|
||||
.page-enter-active,
|
||||
.page-leave-active {
|
||||
transition:
|
||||
opacity 0.4s ease,
|
||||
transform 0.4s ease;
|
||||
}
|
||||
|
||||
.page-enter-from {
|
||||
opacity: 0;
|
||||
transform: translateY(15px);
|
||||
}
|
||||
|
||||
.page-leave-to {
|
||||
opacity: 0;
|
||||
transform: translateY(-15px);
|
||||
}
|
||||
2
client/src/styles/base/_index.scss
Normal file
2
client/src/styles/base/_index.scss
Normal file
@@ -0,0 +1,2 @@
|
||||
@use 'typography';
|
||||
@use 'base';
|
||||
@@ -1,4 +1,4 @@
|
||||
@use '../abstracts/variables' as *;
|
||||
@use '../abstracts' as *;
|
||||
|
||||
body {
|
||||
font-family: $font-family-sans;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@use '../abstracts/variables' as *;
|
||||
@use '../abstracts' as *;
|
||||
|
||||
.glow-btn {
|
||||
box-shadow: $shadow-glow-base;
|
||||
@@ -8,7 +8,7 @@
|
||||
will-change: transform, box-shadow;
|
||||
|
||||
&:hover {
|
||||
transform: translateY(-2px);
|
||||
transform: translateY(-0.125rem);
|
||||
box-shadow: $shadow-glow-hover;
|
||||
}
|
||||
|
||||
@@ -24,3 +24,46 @@
|
||||
cursor: not-allowed;
|
||||
}
|
||||
}
|
||||
|
||||
.lang-switch-wrapper {
|
||||
position: relative;
|
||||
display: flex;
|
||||
width: 100%;
|
||||
height: 3rem;
|
||||
background-color: $bg-glass-subtle;
|
||||
border-radius: $radius-lg;
|
||||
overflow: hidden;
|
||||
border: $border-width-sm solid rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
.lang-glider {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 33.33%;
|
||||
height: 100%;
|
||||
background-color: $color-primary;
|
||||
transition: transform $duration-normal cubic-bezier(0.25, 0.8, 0.5, 1);
|
||||
border-radius: calc($radius-lg - 1px);
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
.lang-btn {
|
||||
flex: 1;
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: $color-text-grey;
|
||||
font-weight: $weight-bold;
|
||||
font-size: $font-sm;
|
||||
cursor: pointer;
|
||||
z-index: 1;
|
||||
transition: color $duration-fast ease;
|
||||
|
||||
&:hover {
|
||||
color: $color-text-white;
|
||||
}
|
||||
|
||||
&.active {
|
||||
color: $color-bg-dark;
|
||||
}
|
||||
}
|
||||
|
||||
26
client/src/styles/components/_cards.scss
Normal file
26
client/src/styles/components/_cards.scss
Normal file
@@ -0,0 +1,26 @@
|
||||
@use '../abstracts' as *;
|
||||
|
||||
.widget-card {
|
||||
@include card-base;
|
||||
border: $border-width-sm solid $color-border;
|
||||
background-color: $color-surface !important;
|
||||
border-radius: $radius-xl !important;
|
||||
}
|
||||
|
||||
.lesson-card {
|
||||
width: 100%;
|
||||
max-width: $size-lesson-card-width;
|
||||
border-radius: $radius-xl !important;
|
||||
border: $border-width-sm solid $color-border;
|
||||
background-color: $color-surface !important;
|
||||
min-height: $size-lesson-card-min-height;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.review-card {
|
||||
border: $border-width-sm solid $color-border;
|
||||
background-color: $color-surface !important;
|
||||
width: 100%;
|
||||
max-width: $size-review-card-max-width;
|
||||
}
|
||||
4
client/src/styles/components/_index.scss
Normal file
4
client/src/styles/components/_index.scss
Normal file
@@ -0,0 +1,4 @@
|
||||
@use 'buttons';
|
||||
@use 'cards';
|
||||
@use 'kanji/index' as kanji;
|
||||
@use 'dashboard/index' as dashboard;
|
||||
@@ -1,189 +0,0 @@
|
||||
@use '../abstracts/variables' as *;
|
||||
@use '../abstracts/mixins' as *;
|
||||
@use 'sass:color';
|
||||
|
||||
.widget-card {
|
||||
@include card-base;
|
||||
|
||||
border: $border-subtle;
|
||||
background-color: $color-surface !important;
|
||||
border-radius: $radius-xl !important;
|
||||
}
|
||||
|
||||
.welcome-btn {
|
||||
height: $size-button-large-height !important;
|
||||
width: $size-button-large-width !important;
|
||||
|
||||
.v-chip {
|
||||
color: white !important;
|
||||
background-color: $color-surface !important;
|
||||
}
|
||||
}
|
||||
|
||||
.streak-shield-avatar {
|
||||
border: 1px solid currentcolor;
|
||||
background: rgb(255 255 255 / 5%);
|
||||
}
|
||||
|
||||
.streak-day-label {
|
||||
font-size: 9px !important;
|
||||
}
|
||||
|
||||
.heatmap-container {
|
||||
width: 100%;
|
||||
|
||||
@include flex-center;
|
||||
}
|
||||
|
||||
.heatmap-year {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(53, 1fr);
|
||||
gap: $gap-heatmap;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.heatmap-week {
|
||||
display: grid;
|
||||
grid-template-rows: repeat(7, max-content);
|
||||
gap: $gap-heatmap;
|
||||
}
|
||||
|
||||
.heatmap-day-wrapper {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.heatmap-cell {
|
||||
width: 100%;
|
||||
height: $size-heatmap-cell-height;
|
||||
border-radius: $radius-xs;
|
||||
transition:
|
||||
opacity $duration-fast,
|
||||
background-color $duration-fast;
|
||||
|
||||
&:hover {
|
||||
opacity: $opacity-hover;
|
||||
}
|
||||
}
|
||||
|
||||
.today-cell {
|
||||
border: $border-width-sm solid $color-text-white;
|
||||
box-shadow: $shadow-glow-xs;
|
||||
z-index: $z-above;
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.level-0 {
|
||||
background-color: $bg-glass-subtle;
|
||||
}
|
||||
|
||||
.level-1 {
|
||||
background-color: color.mix($color-primary, $color-surface, 25%);
|
||||
}
|
||||
|
||||
.level-2 {
|
||||
background-color: color.mix($color-primary, $color-surface, 50%);
|
||||
}
|
||||
|
||||
.level-3 {
|
||||
background-color: $color-primary;
|
||||
}
|
||||
|
||||
.level-4 {
|
||||
background-color: color.scale($color-primary, $lightness: 40%);
|
||||
}
|
||||
|
||||
.legend-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: $spacing-xs;
|
||||
}
|
||||
|
||||
.legend-box {
|
||||
width: $size-legend-box;
|
||||
height: $size-legend-box;
|
||||
border-radius: $radius-xs;
|
||||
}
|
||||
|
||||
.ghost-card {
|
||||
background: $bg-glass-subtle;
|
||||
border-radius: $radius-md;
|
||||
padding: $spacing-sm;
|
||||
text-align: center;
|
||||
border: $border-width-sm solid $bg-glass-subtle;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
min-height: $size-ghost-min-height;
|
||||
}
|
||||
|
||||
.srs-chart-container {
|
||||
height: $size-chart-height;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.srs-column {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.srs-track {
|
||||
width: $size-srs-track;
|
||||
flex-grow: 1;
|
||||
background: $bg-glass-light;
|
||||
border-radius: $radius-md;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
margin: $spacing-xs 0;
|
||||
}
|
||||
|
||||
.srs-fill {
|
||||
width: 100%;
|
||||
border-radius: $radius-sm;
|
||||
transition: height 1s $ease-out-back;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.transition-text {
|
||||
transition: color $duration-normal $ease-default;
|
||||
}
|
||||
|
||||
.streak-dot {
|
||||
width: $size-streak-dot;
|
||||
height: $size-streak-dot;
|
||||
border-radius: $radius-circle;
|
||||
background: $bg-glass-strong;
|
||||
|
||||
@include flex-center;
|
||||
|
||||
transition: all $duration-normal;
|
||||
|
||||
&.active {
|
||||
background: $color-primary;
|
||||
box-shadow: $shadow-glow-active;
|
||||
}
|
||||
}
|
||||
|
||||
.forecast-list {
|
||||
overflow-y: auto;
|
||||
|
||||
@include scrollbar;
|
||||
}
|
||||
|
||||
.srs-chart-container {
|
||||
gap: 8px;
|
||||
|
||||
@media (max-width: 600px) {
|
||||
gap: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
.srs-track {
|
||||
@media (max-width: 400px) {
|
||||
width: 6px;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
@use '../../abstracts' as *;
|
||||
|
||||
.accuracy-chart-wrapper {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
@use '../../abstracts' as *;
|
||||
|
||||
.srs-chart-container {
|
||||
height: $size-chart-height;
|
||||
width: 100%;
|
||||
gap: $gap-srs-chart;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-end;
|
||||
padding-inline: $spacing-2xs;
|
||||
|
||||
@media (max-width: $breakpoint-sm) {
|
||||
gap: $gap-srs-chart-mobile;
|
||||
}
|
||||
}
|
||||
|
||||
.srs-column {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.srs-track {
|
||||
width: $size-srs-track;
|
||||
flex-grow: 1;
|
||||
background: $bg-glass-light;
|
||||
border-radius: $radius-md;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
margin: $spacing-xs 0;
|
||||
|
||||
@media (max-width: $breakpoint-xs) {
|
||||
width: $size-srs-track-mobile;
|
||||
}
|
||||
}
|
||||
|
||||
.srs-fill {
|
||||
width: 100%;
|
||||
border-radius: $radius-sm;
|
||||
transition: height $duration-chart $ease-out-back;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.transition-text {
|
||||
transition: color $duration-normal $ease-default;
|
||||
}
|
||||
|
||||
.srs-label {
|
||||
font-size: $font-size-srs-label !important;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
@use '../../abstracts' as *;
|
||||
|
||||
.forecast-list {
|
||||
overflow-y: auto;
|
||||
@include scrollbar;
|
||||
}
|
||||
13
client/src/styles/components/dashboard/_widget-ghosts.scss
Normal file
13
client/src/styles/components/dashboard/_widget-ghosts.scss
Normal file
@@ -0,0 +1,13 @@
|
||||
@use '../../abstracts' as *;
|
||||
|
||||
.ghost-card {
|
||||
background: $bg-glass-subtle;
|
||||
border-radius: $radius-md;
|
||||
padding: $spacing-sm;
|
||||
text-align: center;
|
||||
border: $border-width-sm solid $bg-glass-subtle;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
min-height: $size-ghost-min-height;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
@use '../../abstracts' as *;
|
||||
|
||||
.mastery-progress {
|
||||
width: 100%;
|
||||
margin-top: $spacing-sm;
|
||||
}
|
||||
73
client/src/styles/components/dashboard/_widget-heatmap.scss
Normal file
73
client/src/styles/components/dashboard/_widget-heatmap.scss
Normal file
@@ -0,0 +1,73 @@
|
||||
@use '../../abstracts' as *;
|
||||
@use 'sass:color';
|
||||
|
||||
.heatmap-container {
|
||||
width: 100%;
|
||||
@include flex-center;
|
||||
}
|
||||
|
||||
.heatmap-year {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(53, 1fr);
|
||||
gap: $gap-heatmap;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.heatmap-week {
|
||||
display: grid;
|
||||
grid-template-rows: repeat(7, max-content);
|
||||
gap: $gap-heatmap;
|
||||
}
|
||||
|
||||
.heatmap-day-wrapper {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.heatmap-cell {
|
||||
width: 100%;
|
||||
height: $size-heatmap-cell;
|
||||
border-radius: $radius-xs;
|
||||
transition:
|
||||
opacity $duration-fast,
|
||||
background-color $duration-fast;
|
||||
|
||||
&:hover {
|
||||
opacity: $opacity-hover;
|
||||
}
|
||||
}
|
||||
|
||||
.today-cell {
|
||||
border: $border-width-sm solid $color-text-white;
|
||||
box-shadow: $shadow-glow-xs;
|
||||
z-index: $z-above;
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.level-0 {
|
||||
background-color: $bg-glass-subtle;
|
||||
}
|
||||
.level-1 {
|
||||
background-color: color.mix($color-primary, $color-surface, 25%);
|
||||
}
|
||||
.level-2 {
|
||||
background-color: color.mix($color-primary, $color-surface, 50%);
|
||||
}
|
||||
.level-3 {
|
||||
background-color: $color-primary;
|
||||
}
|
||||
.level-4 {
|
||||
background-color: color.scale($color-primary, $lightness: 40%);
|
||||
}
|
||||
|
||||
.legend-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: $spacing-xs;
|
||||
}
|
||||
|
||||
.legend-box {
|
||||
width: $size-legend-box;
|
||||
height: $size-legend-box;
|
||||
border-radius: $radius-xs;
|
||||
}
|
||||
24
client/src/styles/components/dashboard/_widget-streak.scss
Normal file
24
client/src/styles/components/dashboard/_widget-streak.scss
Normal file
@@ -0,0 +1,24 @@
|
||||
@use '../../abstracts' as *;
|
||||
|
||||
.streak-shield-avatar {
|
||||
border: $border-width-sm solid currentcolor;
|
||||
background: $bg-glass-subtle;
|
||||
}
|
||||
|
||||
.streak-day-label {
|
||||
font-size: $font-size-heatmap-label !important;
|
||||
}
|
||||
|
||||
.streak-dot {
|
||||
width: $size-streak-dot;
|
||||
height: $size-streak-dot;
|
||||
border-radius: $radius-circle;
|
||||
background: $bg-glass-strong;
|
||||
@include flex-center;
|
||||
transition: all $duration-normal;
|
||||
|
||||
&.active {
|
||||
background: $color-primary;
|
||||
box-shadow: $shadow-glow-active;
|
||||
}
|
||||
}
|
||||
82
client/src/styles/components/dashboard/_widget-welcome.scss
Normal file
82
client/src/styles/components/dashboard/_widget-welcome.scss
Normal file
@@ -0,0 +1,82 @@
|
||||
@use '../../abstracts' as *;
|
||||
@use 'sass:color';
|
||||
|
||||
.zen-wrapper {
|
||||
max-width: $breakpoint-md;
|
||||
margin-inline: auto;
|
||||
}
|
||||
|
||||
.zen-btn {
|
||||
min-width: $size-button-large-width;
|
||||
max-width: $size-zen-btn-max-width;
|
||||
height: $size-button-zen-height !important;
|
||||
transition: all $duration-normal cubic-bezier(0.25, 0.8, 0.5, 1);
|
||||
backdrop-filter: blur(4px);
|
||||
-webkit-backdrop-filter: blur(4px);
|
||||
&:hover:not(:disabled) {
|
||||
transform: translateY(-0.125rem);
|
||||
background-color: rgba($color-text-white, 0.08) !important;
|
||||
box-shadow: $shadow-md;
|
||||
}
|
||||
|
||||
&.zen-disabled {
|
||||
opacity: $opacity-inactive;
|
||||
background-color: color.scale($color-surface, $lightness: 10%) !important;
|
||||
border-color: $color-stroke-inactive !important;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
@media (max-width: $breakpoint-sm) {
|
||||
height: auto !important;
|
||||
padding: $spacing-sm !important;
|
||||
min-height: $size-button-zen-height;
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
|
||||
.zen-btn-content {
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.zen-counter {
|
||||
margin-left: 0 !important;
|
||||
margin-top: $spacing-xs;
|
||||
flex-basis: 100%;
|
||||
max-width: 100%;
|
||||
justify-content: center;
|
||||
height: 1.75rem;
|
||||
}
|
||||
.d-flex.flex-column {
|
||||
flex-basis: auto;
|
||||
flex-grow: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.zen-counter {
|
||||
@include flex-center;
|
||||
|
||||
font-size: $font-sm;
|
||||
font-weight: $weight-black;
|
||||
height: $size-icon-btn;
|
||||
min-width: $size-icon-btn;
|
||||
padding: 0 calc($spacing-md * 0.75);
|
||||
border-radius: $radius-xl;
|
||||
}
|
||||
|
||||
.line-height-tight {
|
||||
line-height: $leading-tight;
|
||||
margin-bottom: $spacing-2xs;
|
||||
}
|
||||
|
||||
.opacity-80 {
|
||||
opacity: $opacity-hover;
|
||||
}
|
||||
|
||||
.letter-spacing-small {
|
||||
letter-spacing: $tracking-tighter;
|
||||
}
|
||||
|
||||
.letter-spacing-1 {
|
||||
letter-spacing: 0.09375rem;
|
||||
}
|
||||
8
client/src/styles/components/dashboard/index.scss
Normal file
8
client/src/styles/components/dashboard/index.scss
Normal file
@@ -0,0 +1,8 @@
|
||||
@use 'widget-welcome';
|
||||
@use 'widget-heatmap';
|
||||
@use 'widget-ghosts';
|
||||
@use 'widget-distribution';
|
||||
@use 'widget-streak';
|
||||
@use 'widget-forecast';
|
||||
@use 'widget-accuracy';
|
||||
@use 'widget-guru-mastery';
|
||||
2
client/src/styles/components/kanji/_index.scss
Normal file
2
client/src/styles/components/kanji/_index.scss
Normal file
@@ -0,0 +1,2 @@
|
||||
@use 'kanji-canvas';
|
||||
@use 'kanji-svg-viewer';
|
||||
55
client/src/styles/components/kanji/_kanji-canvas.scss
Normal file
55
client/src/styles/components/kanji/_kanji-canvas.scss
Normal file
@@ -0,0 +1,55 @@
|
||||
@use '../../abstracts' as *;
|
||||
|
||||
.canvas-container {
|
||||
position: relative;
|
||||
@include flex-center;
|
||||
}
|
||||
|
||||
.canvas-wrapper {
|
||||
position: relative;
|
||||
width: $size-canvas;
|
||||
height: $size-canvas;
|
||||
background: $color-surface;
|
||||
border-radius: $radius-lg;
|
||||
border: $border-width-sm solid $color-border;
|
||||
box-shadow: $shadow-inset;
|
||||
overflow: hidden;
|
||||
cursor: crosshair;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
canvas {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
touch-action: none;
|
||||
z-index: $z-above;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes shake-x {
|
||||
0%,
|
||||
100% {
|
||||
transform: translateX(0);
|
||||
}
|
||||
20% {
|
||||
transform: translateX(-0.375rem);
|
||||
}
|
||||
40% {
|
||||
transform: translateX(0.375rem);
|
||||
}
|
||||
60% {
|
||||
transform: translateX(-0.375rem);
|
||||
}
|
||||
80% {
|
||||
transform: translateX(0.375rem);
|
||||
}
|
||||
}
|
||||
|
||||
.shake {
|
||||
animation: shake-x 0.4s ease-in-out;
|
||||
border-color: $color-danger !important;
|
||||
}
|
||||
@@ -1,7 +1,19 @@
|
||||
@use '../abstracts/variables' as *;
|
||||
@use '../abstracts/mixins' as *;
|
||||
@use '../../abstracts' as *;
|
||||
@use 'sass:color';
|
||||
|
||||
.svg-container {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
overflow: hidden;
|
||||
background: $color-surface;
|
||||
border-radius: $radius-lg;
|
||||
border: $border-width-sm solid $color-border;
|
||||
box-shadow: $shadow-inset;
|
||||
|
||||
@mixin grid-overlay {
|
||||
&::before,
|
||||
&::after {
|
||||
content: '';
|
||||
@@ -15,78 +27,26 @@
|
||||
|
||||
&::before {
|
||||
top: 50%;
|
||||
left: 10px;
|
||||
right: 10px;
|
||||
border-top-width: 1px;
|
||||
left: $size-play-btn-offset;
|
||||
right: $size-play-btn-offset;
|
||||
border-top-width: $border-width-sm;
|
||||
}
|
||||
|
||||
&::after {
|
||||
left: 50%;
|
||||
top: 10px;
|
||||
bottom: 10px;
|
||||
border-left-width: 1px;
|
||||
top: $size-play-btn-offset;
|
||||
bottom: $size-play-btn-offset;
|
||||
border-left-width: $border-width-sm;
|
||||
}
|
||||
}
|
||||
|
||||
.canvas-container {
|
||||
position: relative;
|
||||
|
||||
@include flex-center;
|
||||
}
|
||||
|
||||
// The main drawing canvas wrapper
|
||||
.canvas-wrapper {
|
||||
position: relative;
|
||||
width: $size-canvas;
|
||||
height: $size-canvas;
|
||||
background: $color-surface;
|
||||
border-radius: $radius-lg;
|
||||
border: $border-subtle;
|
||||
box-shadow: $shadow-inset;
|
||||
overflow: hidden;
|
||||
cursor: crosshair;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
canvas {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
touch-action: none;
|
||||
z-index: $z-above;
|
||||
}
|
||||
}
|
||||
|
||||
// The SVG Viewer wrapper (Review/Lesson/Collection)
|
||||
.svg-container {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
overflow: hidden;
|
||||
|
||||
// --- Unified Styles to match Canvas ---
|
||||
background: $color-surface;
|
||||
border-radius: $radius-lg; // Matches canvas-wrapper
|
||||
border: $border-subtle; // Matches canvas-wrapper
|
||||
box-shadow: $shadow-inset; // Matches canvas-wrapper
|
||||
// -------------------------------------
|
||||
|
||||
@include grid-overlay;
|
||||
|
||||
&.hero-mode {
|
||||
background: linear-gradient(145deg, $color-surface, #18181b);
|
||||
border: 2px solid $color-border;
|
||||
box-shadow: 0 4px 20px rgb(0 0 0 / 40%);
|
||||
background: linear-gradient(145deg, $color-surface, $color-zinc-900);
|
||||
border: $border-width-md solid $color-border;
|
||||
box-shadow: 0 0.25rem 1.25rem hsl(0deg 0% 0% / 40%);
|
||||
|
||||
.stroke-path.drawn {
|
||||
stroke: $color-text-white;
|
||||
filter: drop-shadow(0 0 2px rgb(255 255 255 / 25%));
|
||||
filter: drop-shadow(0 0 0.125rem hsl(0deg 0% 100% / 25%));
|
||||
}
|
||||
|
||||
&::before,
|
||||
@@ -110,17 +70,15 @@
|
||||
stroke-linejoin: round;
|
||||
stroke-width: $stroke-width-main;
|
||||
transition:
|
||||
stroke 0.3s ease,
|
||||
opacity 0.3s ease;
|
||||
stroke $duration-normal ease,
|
||||
opacity $duration-normal ease;
|
||||
|
||||
&.drawn {
|
||||
stroke: $color-stroke-drawn;
|
||||
}
|
||||
|
||||
&.hidden {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
&.animating {
|
||||
stroke: $color-primary;
|
||||
stroke-dasharray: var(--len);
|
||||
@@ -136,18 +94,18 @@
|
||||
stroke-linecap: round;
|
||||
stroke-linejoin: round;
|
||||
opacity: 0.5;
|
||||
stroke-dasharray: 10 15;
|
||||
stroke-dasharray: 0.625rem 0.9375rem;
|
||||
}
|
||||
|
||||
.stroke-badge-group {
|
||||
filter: drop-shadow(0 1px 2px rgb(0 0 0 / 50%));
|
||||
filter: drop-shadow(0 0.0625rem 0.125rem hsl(0deg 0% 0% / 50%));
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.stroke-badge-bg {
|
||||
fill: $color-primary;
|
||||
opacity: 0.9;
|
||||
transition: transform 0.2s ease;
|
||||
transition: transform $duration-fast ease;
|
||||
}
|
||||
|
||||
.stroke-badge-text {
|
||||
@@ -168,34 +126,31 @@
|
||||
stroke-linecap: round;
|
||||
stroke-linejoin: round;
|
||||
pointer-events: none;
|
||||
filter: drop-shadow(0 0 2px rgb(0 0 0 / 50%));
|
||||
filter: drop-shadow(0 0 0.125rem hsl(0deg 0% 0% / 50%));
|
||||
}
|
||||
|
||||
.play-btn {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 10px;
|
||||
top: $size-play-btn-offset;
|
||||
right: $size-play-btn-offset;
|
||||
width: $size-icon-btn;
|
||||
height: $size-icon-btn;
|
||||
border-radius: $radius-circle;
|
||||
background: rgb(255 255 255 / 10%);
|
||||
border: 1px solid rgba($color-primary, 0.3);
|
||||
background: $bg-glass-strong;
|
||||
border: 1px solid color.change($color-primary, $alpha: 0.3);
|
||||
color: $color-primary;
|
||||
|
||||
@include flex-center;
|
||||
|
||||
cursor: pointer;
|
||||
z-index: $z-play-btn;
|
||||
transition: all 0.2s ease;
|
||||
transition: all $duration-fast ease;
|
||||
|
||||
&:hover {
|
||||
transform: scale(1.05);
|
||||
background: rgba($color-primary, 0.2);
|
||||
background: color.change($color-primary, $alpha: 0.2);
|
||||
}
|
||||
|
||||
svg {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
width: $size-icon-small;
|
||||
height: $size-icon-small;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,31 +159,3 @@
|
||||
stroke-dashoffset: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes shake-x {
|
||||
0%,
|
||||
100% {
|
||||
transform: translateX(0);
|
||||
}
|
||||
|
||||
20% {
|
||||
transform: translateX(-6px);
|
||||
}
|
||||
|
||||
40% {
|
||||
transform: translateX(6px);
|
||||
}
|
||||
|
||||
60% {
|
||||
transform: translateX(-6px);
|
||||
}
|
||||
|
||||
80% {
|
||||
transform: translateX(6px);
|
||||
}
|
||||
}
|
||||
|
||||
.shake {
|
||||
animation: shake-x 0.4s ease-in-out;
|
||||
border-color: $color-danger !important;
|
||||
}
|
||||
31
client/src/styles/layout/_app-shell.scss
Normal file
31
client/src/styles/layout/_app-shell.scss
Normal file
@@ -0,0 +1,31 @@
|
||||
@use '../abstracts' as *;
|
||||
|
||||
.v-navigation-drawer {
|
||||
background-color: $color-surface !important;
|
||||
border-right: $border-width-sm solid $color-border;
|
||||
|
||||
.v-list-item--active {
|
||||
background-color: $bg-glass-strong;
|
||||
color: $color-primary !important;
|
||||
|
||||
.v-icon {
|
||||
color: $color-primary !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.app-bar-blur {
|
||||
border-bottom: $border-width-sm solid $color-border !important;
|
||||
backdrop-filter: $blur-md;
|
||||
background-color: rgba($color-surface, 0.8) !important;
|
||||
}
|
||||
|
||||
.safe-area-header {
|
||||
padding-top: env(safe-area-inset-top);
|
||||
height: auto !important;
|
||||
|
||||
:deep(.v-toolbar__content) {
|
||||
min-height: 4rem;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
1
client/src/styles/layout/_index.scss
Normal file
1
client/src/styles/layout/_index.scss
Normal file
@@ -0,0 +1 @@
|
||||
@use 'app-shell';
|
||||
@@ -1,11 +1,7 @@
|
||||
@use 'abstracts/variables';
|
||||
@use 'abstracts/mixins';
|
||||
@use 'base/typography';
|
||||
@use 'components/buttons';
|
||||
@use 'components/widgets';
|
||||
@use 'components/kanji';
|
||||
@use 'pages/app';
|
||||
@use 'pages/dashboard';
|
||||
@use 'pages/review';
|
||||
@use 'pages/collection';
|
||||
@use 'pages/lesson';
|
||||
@charset 'utf-8';
|
||||
|
||||
@use 'abstracts';
|
||||
@use 'base';
|
||||
@use 'layout';
|
||||
@use 'components';
|
||||
@use 'pages';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
@use '../abstracts/variables' as *;
|
||||
@use '../abstracts/mixins' as *;
|
||||
@use '../abstracts' as *;
|
||||
|
||||
.sticky-search {
|
||||
position: sticky;
|
||||
@@ -22,11 +21,10 @@
|
||||
.kanji-card {
|
||||
@include card-base;
|
||||
@include hover-lift;
|
||||
|
||||
aspect-ratio: 1;
|
||||
|
||||
@include flex-column;
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: relative;
|
||||
@@ -36,17 +34,17 @@
|
||||
font-size: $font-2xl;
|
||||
font-weight: $weight-medium;
|
||||
line-height: $leading-tight;
|
||||
transition: all 0.3s ease;
|
||||
transition: all $duration-normal ease;
|
||||
}
|
||||
|
||||
&.zen-master {
|
||||
border: 1px solid rgb(255 215 0 / 50%);
|
||||
background: linear-gradient(135deg, rgb(30 30 36 / 100%) 0%, rgb(45 45 55 / 100%) 100%);
|
||||
box-shadow: 0 0 15px rgb(255 215 0 / 15%);
|
||||
border: $border-width-sm solid $color-gold-glow;
|
||||
background: linear-gradient(135deg, $color-surface 0%, $color-surface-lighter 100%);
|
||||
box-shadow: 0 0 0.9375rem $color-gold-glow;
|
||||
animation: zen-pulse 4s infinite ease-in-out;
|
||||
|
||||
.k-char {
|
||||
text-shadow: 0 0 15px rgb(255 215 0 / 60%);
|
||||
text-shadow: 0 0 0.9375rem $color-gold-glow-strong;
|
||||
transform: scale(1.1);
|
||||
}
|
||||
}
|
||||
@@ -66,19 +64,19 @@
|
||||
|
||||
.k-bars {
|
||||
display: flex;
|
||||
gap: 3px;
|
||||
gap: 0.1875rem;
|
||||
width: 60%;
|
||||
height: 4px;
|
||||
height: 0.25rem;
|
||||
margin-top: $spacing-sm;
|
||||
|
||||
.bar {
|
||||
flex: 1;
|
||||
background: rgb(255 255 255 / 10%);
|
||||
border-radius: 2px;
|
||||
transition: background-color 0.3s ease;
|
||||
background: $color-overlay-white;
|
||||
border-radius: $radius-xs;
|
||||
transition: background-color $duration-normal ease;
|
||||
|
||||
&.filled {
|
||||
box-shadow: 0 0 4px rgb(0 0 0 / 30%);
|
||||
box-shadow: $shadow-srs-fill;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -86,18 +84,16 @@
|
||||
|
||||
@keyframes zen-pulse {
|
||||
0% {
|
||||
box-shadow: 0 0 10px rgb(255 215 0 / 10%);
|
||||
border-color: rgb(255 215 0 / 30%);
|
||||
box-shadow: 0 0 0.625rem $color-gold-border;
|
||||
border-color: $color-gold-border;
|
||||
}
|
||||
|
||||
50% {
|
||||
box-shadow: 0 0 20px rgb(255 215 0 / 30%);
|
||||
border-color: rgb(255 215 0 / 80%);
|
||||
box-shadow: 0 0 1.25rem $color-gold-border;
|
||||
border-color: $color-gold-glow;
|
||||
}
|
||||
|
||||
100% {
|
||||
box-shadow: 0 0 10px rgb(255 215 0 / 10%);
|
||||
border-color: rgb(255 215 0 / 30%);
|
||||
box-shadow: 0 0 0.625rem $color-gold-border;
|
||||
border-color: $color-gold-border;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
@use '../abstracts/variables' as *;
|
||||
@use '../abstracts/mixins' as *;
|
||||
@use '../abstracts' as *;
|
||||
|
||||
@keyframes dashboard-pop-in {
|
||||
0% {
|
||||
opacity: 0;
|
||||
transform: translateY(20px) scale(0.95);
|
||||
}
|
||||
100% {
|
||||
opacity: 1;
|
||||
transform: translateY(0) scale(1);
|
||||
}
|
||||
}
|
||||
|
||||
.dashboard-layout {
|
||||
display: grid;
|
||||
@@ -11,24 +21,61 @@
|
||||
margin: 0 auto;
|
||||
padding: $padding-page-y $padding-page-x;
|
||||
box-sizing: border-box;
|
||||
min-height: 50vh;
|
||||
|
||||
&.fade-in {
|
||||
@include animate-fade-up($duration-slow);
|
||||
// Center the loader when state is loading
|
||||
&.is-loading {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
// Trigger animations for all items when data is ready
|
||||
&.is-ready {
|
||||
.slide-up-item {
|
||||
animation: dashboard-pop-in 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
|
||||
}
|
||||
}
|
||||
|
||||
.grid-area-full {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
// Base state for animated items
|
||||
.slide-up-item {
|
||||
opacity: 0;
|
||||
// Use the --delay variable passed from Vue, defaulting to 0ms
|
||||
animation-delay: var(--delay, 0ms);
|
||||
will-change: transform, opacity;
|
||||
}
|
||||
|
||||
.stats-split-layout {
|
||||
grid-column: 1 / -1;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: $spacing-lg;
|
||||
|
||||
@include grid-responsive($breakpoint-md);
|
||||
.stats-left {
|
||||
grid-column: 1 / 3;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: $spacing-lg;
|
||||
}
|
||||
|
||||
.stats-right {
|
||||
grid-column: 3 / 4;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: $spacing-lg;
|
||||
}
|
||||
|
||||
@media (max-width: $breakpoint-md) {
|
||||
grid-template-columns: 1fr;
|
||||
|
||||
.stats-left,
|
||||
.stats-right {
|
||||
@include flex-column($spacing-lg);
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
4
client/src/styles/pages/_index.scss
Normal file
4
client/src/styles/pages/_index.scss
Normal file
@@ -0,0 +1,4 @@
|
||||
@use 'dashboard';
|
||||
@use 'collection';
|
||||
@use 'review';
|
||||
@use 'lesson';
|
||||
@@ -1,8 +1,8 @@
|
||||
@use '../abstracts/variables' as *;
|
||||
@use '../abstracts/mixins' as *;
|
||||
@use '../abstracts' as *;
|
||||
|
||||
.page-container-center {
|
||||
height: 100%;
|
||||
min-height: 100%;
|
||||
height: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
@@ -11,17 +11,6 @@
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.lesson-card {
|
||||
width: 100%;
|
||||
max-width: $size-lesson-card-width;
|
||||
border-radius: $radius-xl !important;
|
||||
border: $border-subtle;
|
||||
background-color: $color-surface !important;
|
||||
min-height: $size-lesson-card-min-height;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.hero-wrapper {
|
||||
width: $size-hero-wrapper;
|
||||
height: $size-hero-wrapper;
|
||||
@@ -37,8 +26,8 @@
|
||||
|
||||
.radical-chip {
|
||||
border-radius: $radius-md;
|
||||
border: $border-subtle;
|
||||
background-color: #27272a;
|
||||
border: $border-width-sm solid $color-border;
|
||||
background-color: $color-surface-lighter;
|
||||
|
||||
img {
|
||||
filter: invert(1);
|
||||
@@ -62,7 +51,7 @@
|
||||
.label {
|
||||
font-size: $font-xs;
|
||||
color: #666;
|
||||
letter-spacing: 1px;
|
||||
letter-spacing: 0.0625rem;
|
||||
text-transform: uppercase;
|
||||
margin-bottom: $spacing-xs;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,4 @@
|
||||
@use '../abstracts/variables' as *;
|
||||
@use '../abstracts/mixins' as *;
|
||||
|
||||
.review-card {
|
||||
border: $border-subtle;
|
||||
background-color: $color-surface !important;
|
||||
width: 100%;
|
||||
max-width: 420px;
|
||||
}
|
||||
@use '../abstracts' as *;
|
||||
|
||||
.text-shadow {
|
||||
text-shadow: $text-shadow;
|
||||
@@ -18,8 +10,8 @@
|
||||
|
||||
.next-fab {
|
||||
position: absolute;
|
||||
bottom: 20px;
|
||||
right: 20px;
|
||||
bottom: $offset-fab;
|
||||
right: $offset-fab;
|
||||
z-index: $z-sticky;
|
||||
}
|
||||
}
|
||||
@@ -28,7 +20,6 @@
|
||||
.scale-leave-active {
|
||||
transition: all $duration-normal $ease-out-back;
|
||||
}
|
||||
|
||||
.scale-enter-from,
|
||||
.scale-leave-to {
|
||||
opacity: 0;
|
||||
@@ -39,25 +30,18 @@
|
||||
.fade-slide-leave-active {
|
||||
transition: all $duration-normal $ease-default;
|
||||
}
|
||||
|
||||
.fade-slide-enter-from {
|
||||
opacity: 0;
|
||||
transform: translateY($dist-slide-sm);
|
||||
}
|
||||
|
||||
.fade-slide-leave-to {
|
||||
opacity: 0;
|
||||
transform: translateY(-#{$dist-slide-sm});
|
||||
}
|
||||
|
||||
.opacity-80 {
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.progress-bar {
|
||||
opacity: 0.3;
|
||||
opacity: $opacity-inactive;
|
||||
}
|
||||
|
||||
.gap-2 {
|
||||
gap: $spacing-sm;
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ export class KanjiController {
|
||||
this.isAnimating = false;
|
||||
|
||||
this.ctx = { bg: null, hint: null, draw: null };
|
||||
this.hintAnimationFrame = null;
|
||||
}
|
||||
|
||||
static createPathElement(d) {
|
||||
@@ -120,7 +121,16 @@ export class KanjiController {
|
||||
}
|
||||
}
|
||||
|
||||
setAutoHint(val) {
|
||||
this.autoHint = val;
|
||||
if (!val) {
|
||||
this.clearCanvas(this.ctx.hint);
|
||||
}
|
||||
}
|
||||
|
||||
async loadChar(char, autoHint = false) {
|
||||
this.autoHint = autoHint;
|
||||
this.paths = [];
|
||||
this.reset();
|
||||
const hex = char.charCodeAt(0).toString(16).padStart(5, '0');
|
||||
|
||||
@@ -139,6 +149,11 @@ export class KanjiController {
|
||||
}
|
||||
|
||||
reset() {
|
||||
if (this.hintAnimationFrame) {
|
||||
cancelAnimationFrame(this.hintAnimationFrame);
|
||||
this.hintAnimationFrame = null;
|
||||
}
|
||||
|
||||
this.currentStrokeIdx = 0;
|
||||
this.mistakes = 0;
|
||||
this.isAnimating = false;
|
||||
@@ -148,6 +163,10 @@ export class KanjiController {
|
||||
this.clearCanvas(this.ctx.hint);
|
||||
this.drawGrid();
|
||||
this.resetDrawStyle();
|
||||
|
||||
if (this.autoHint && this.paths.length > 0) {
|
||||
this.showHint();
|
||||
}
|
||||
}
|
||||
|
||||
startStroke(point) {
|
||||
@@ -191,6 +210,11 @@ export class KanjiController {
|
||||
}
|
||||
|
||||
showHint() {
|
||||
if (this.hintAnimationFrame) {
|
||||
cancelAnimationFrame(this.hintAnimationFrame);
|
||||
this.hintAnimationFrame = null;
|
||||
}
|
||||
|
||||
this.clearCanvas(this.ctx.hint);
|
||||
if (this.currentStrokeIdx >= this.paths.length) return;
|
||||
|
||||
@@ -199,20 +223,49 @@ export class KanjiController {
|
||||
const len = pathEl.getTotalLength();
|
||||
|
||||
const ctx = this.ctx.hint;
|
||||
ctx.beginPath();
|
||||
ctx.strokeStyle = KANJI_CONSTANTS.COLORS.HINT;
|
||||
ctx.setLineDash(KANJI_CONSTANTS.DASH_ARRAY_HINT);
|
||||
|
||||
const step = 5;
|
||||
const count = Math.floor(len / step) + 1;
|
||||
const startTime = performance.now();
|
||||
const DURATION = 600;
|
||||
|
||||
Array.from({ length: count }).forEach((_, i) => {
|
||||
const dist = Math.min(i * step, len);
|
||||
const animate = (now) => {
|
||||
const elapsed = now - startTime;
|
||||
const progress = Math.min(elapsed / DURATION, 1);
|
||||
|
||||
this.clearCanvas(ctx);
|
||||
ctx.beginPath();
|
||||
|
||||
const drawLen = len * progress;
|
||||
const step = 5;
|
||||
|
||||
let first = true;
|
||||
for (let dist = 0; dist <= drawLen; dist += step) {
|
||||
const pt = pathEl.getPointAtLength(dist);
|
||||
if (i === 0) ctx.moveTo(pt.x * this.scale, pt.y * this.scale);
|
||||
if (first) {
|
||||
ctx.moveTo(pt.x * this.scale, pt.y * this.scale);
|
||||
first = false;
|
||||
} else {
|
||||
ctx.lineTo(pt.x * this.scale, pt.y * this.scale);
|
||||
}
|
||||
}
|
||||
|
||||
if (drawLen > 0) {
|
||||
const pt = pathEl.getPointAtLength(drawLen);
|
||||
if (first) ctx.moveTo(pt.x * this.scale, pt.y * this.scale);
|
||||
else ctx.lineTo(pt.x * this.scale, pt.y * this.scale);
|
||||
});
|
||||
}
|
||||
|
||||
ctx.stroke();
|
||||
|
||||
if (progress < 1) {
|
||||
this.hintAnimationFrame = requestAnimationFrame(animate);
|
||||
} else {
|
||||
this.hintAnimationFrame = null;
|
||||
}
|
||||
};
|
||||
|
||||
this.hintAnimationFrame = requestAnimationFrame(animate);
|
||||
}
|
||||
|
||||
redrawAllPerfectStrokes(includeCurrent = false) {
|
||||
@@ -257,13 +310,22 @@ export class KanjiController {
|
||||
}));
|
||||
|
||||
if (this.checkMatch(userNormalized, targetD)) {
|
||||
if (this.hintAnimationFrame) {
|
||||
cancelAnimationFrame(this.hintAnimationFrame);
|
||||
this.hintAnimationFrame = null;
|
||||
}
|
||||
|
||||
this.animateMorph(this.userPath, targetD, () => {
|
||||
this.currentStrokeIdx += 1;
|
||||
this.mistakes = 0;
|
||||
this.redrawAllPerfectStrokes();
|
||||
|
||||
this.clearCanvas(this.ctx.hint);
|
||||
|
||||
if (this.currentStrokeIdx >= this.paths.length) {
|
||||
this.onComplete();
|
||||
} else if (this.autoHint) {
|
||||
this.showHint();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
||||
@@ -37,6 +37,13 @@
|
||||
:class="{ 'zen-master': item.srsLevel >= 10 }"
|
||||
@click="openDetail(item)"
|
||||
)
|
||||
v-fade-transition
|
||||
.loading-overlay.d-flex.align-center.justify-center.fill-height.w-100.position-absolute.bg-surface(
|
||||
v-if="preparingId === item._id"
|
||||
style="z-index: 5; opacity: 0.9;"
|
||||
)
|
||||
v-progress-circular(indeterminate color="primary" size="24")
|
||||
|
||||
.k-char(:style="{ color: item.srsLevel >= 10 ? '#ffd700' : getSRSColor(item.srsLevel) }")
|
||||
| {{ item.char }}
|
||||
|
||||
@@ -82,6 +89,7 @@
|
||||
KanjiSvgViewer.mb-4(
|
||||
v-if="showModal && selectedItem"
|
||||
:char="selectedItem.char"
|
||||
:svg-content="preloadedSvg"
|
||||
)
|
||||
|
||||
.readings-container.mb-4
|
||||
@@ -131,6 +139,8 @@ const loading = ref(true);
|
||||
const showModal = ref(false);
|
||||
const selectedItem = ref(null);
|
||||
const searchQuery = ref('');
|
||||
const preparingId = ref(null);
|
||||
const preloadedSvg = ref('');
|
||||
|
||||
onMounted(async () => {
|
||||
await store.fetchCollection();
|
||||
@@ -175,9 +185,27 @@ const SRS_COLORS = {
|
||||
|
||||
const getSRSColor = (lvl) => SRS_COLORS[lvl] || '#444';
|
||||
|
||||
const openDetail = (item) => {
|
||||
const openDetail = async (item) => {
|
||||
if (preparingId.value) return;
|
||||
// eslint-disable-next-line no-underscore-dangle
|
||||
preparingId.value = item._id;
|
||||
|
||||
try {
|
||||
const hex = item.char.charCodeAt(0).toString(16).padStart(5, '0');
|
||||
const res = await fetch(`https://raw.githubusercontent.com/KanjiVG/kanjivg/master/kanji/${hex}.svg`);
|
||||
if (res.ok) {
|
||||
preloadedSvg.value = await res.text();
|
||||
} else {
|
||||
preloadedSvg.value = '';
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
preloadedSvg.value = '';
|
||||
} finally {
|
||||
preparingId.value = null;
|
||||
selectedItem.value = item;
|
||||
showModal.value = true;
|
||||
}
|
||||
};
|
||||
|
||||
const redoLesson = () => {
|
||||
@@ -206,5 +234,3 @@ const getNextReviewText = (dateStr, srsLvl) => {
|
||||
return `Next: ${diffDays}d`;
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" src="@/styles/pages/_collection.scss" scoped></style>
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
<template lang="pug">
|
||||
.dashboard-layout.fade-in
|
||||
.dashboard-layout(
|
||||
:class="{ 'is-loading': loading, 'is-ready': !loading }"
|
||||
)
|
||||
.d-flex.justify-center.align-center.fill-height.grid-area-full(
|
||||
v-if="loading"
|
||||
style="min-height: 60vh;"
|
||||
)
|
||||
v-progress-circular(
|
||||
indeterminate
|
||||
color="primary"
|
||||
size="64"
|
||||
width="6"
|
||||
)
|
||||
|
||||
template(v-else)
|
||||
.grid-area-full.slide-up-item(style="--delay: 0ms")
|
||||
WidgetWelcome(
|
||||
:queue-length="stats.queueLength"
|
||||
:lesson-count="stats.lessonCount"
|
||||
@@ -9,31 +24,31 @@
|
||||
@start="handleStart"
|
||||
)
|
||||
|
||||
.grid-area-full(v-if="!loading")
|
||||
.grid-area-full.slide-up-item(style="--delay: 100ms")
|
||||
WidgetHeatmap(:heatmap-data="stats.heatmap")
|
||||
|
||||
.stats-split-layout(v-if="!loading")
|
||||
.stats-left.d-flex.flex-column.gap-4
|
||||
.stats-split-layout
|
||||
.stats-left
|
||||
.slide-up-item(style="--delay: 200ms")
|
||||
WidgetGhosts(:ghosts="stats.ghosts")
|
||||
.slide-up-item(style="--delay: 300ms")
|
||||
WidgetDistribution(:distribution="stats.distribution")
|
||||
.slide-up-item(style="--delay: 400ms")
|
||||
WidgetGuruMastery(:distribution="stats.distribution")
|
||||
|
||||
.stats-right
|
||||
.slide-up-item(style="--delay: 250ms")
|
||||
WidgetAccuracy(:accuracy="stats.accuracy")
|
||||
.slide-up-item(style="--delay: 350ms")
|
||||
WidgetStreak(:streak="stats.streak")
|
||||
.slide-up-item(style="--delay: 450ms")
|
||||
WidgetForecast(:forecast="stats.forecast")
|
||||
|
||||
.grid-area-full.d-flex.justify-center.mt-12(v-if="loading")
|
||||
v-progress-circular(
|
||||
indeterminate
|
||||
color="#00cec9"
|
||||
size="64"
|
||||
)
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
/* eslint-disable no-unused-vars */
|
||||
import { ref, onMounted } from 'vue';
|
||||
import { ref, onMounted, computed } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useAppStore } from '@/stores/appStore';
|
||||
|
||||
@@ -50,25 +65,16 @@ const store = useAppStore();
|
||||
const router = useRouter();
|
||||
const loading = ref(true);
|
||||
|
||||
const stats = ref({
|
||||
queueLength: 0,
|
||||
lessonCount: 0,
|
||||
hasLowerLevels: false,
|
||||
lowerLevelCount: 0,
|
||||
distribution: {},
|
||||
forecast: [],
|
||||
ghosts: [],
|
||||
accuracy: { total: 0, correct: 0 },
|
||||
heatmap: {},
|
||||
streak: { current: 0, history: [], shield: { ready: false } },
|
||||
});
|
||||
const stats = computed(() => store.stats || {});
|
||||
|
||||
onMounted(async () => {
|
||||
loading.value = true;
|
||||
|
||||
try {
|
||||
const data = await store.fetchStats();
|
||||
if (data) {
|
||||
stats.value = { ...stats.value, ...data };
|
||||
}
|
||||
await Promise.all([
|
||||
store.fetchStats(),
|
||||
new Promise((resolve) => { setTimeout(resolve, 800); }),
|
||||
]);
|
||||
} catch (e) {
|
||||
console.error('Dashboard Load Error:', e);
|
||||
} finally {
|
||||
@@ -80,5 +86,3 @@ function handleStart(mode) {
|
||||
router.push({ path: '/review', query: { mode } });
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" src="@/styles/pages/_dashboard.scss" scoped></style>
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
<template lang="pug">
|
||||
v-container.page-container-center
|
||||
v-container.page-container-center.fill-height
|
||||
.d-flex.flex-column.justify-center.align-center.fill-height(v-if="loading")
|
||||
v-progress-circular(indeterminate color="primary" size="64")
|
||||
.text-body-1.text-grey.mt-4 {{ $t('review.loading') }}
|
||||
|
||||
v-card.lesson-card(
|
||||
v-if="currentItem"
|
||||
elevation="0"
|
||||
v-else-if="currentItem"
|
||||
)
|
||||
.d-flex.align-center.pa-4.border-b-subtle
|
||||
v-btn(icon="mdi-close" variant="text" to="/dashboard" color="grey")
|
||||
@@ -82,7 +84,7 @@
|
||||
) {{ $t('lesson.ready') }}
|
||||
.d-flex.justify-center.gap-4.mt-2(v-if="phase === 'drawing' && subPhase === 'practice'")
|
||||
v-btn(
|
||||
variant="text" color="amber" @click="canvas?.showHint()"
|
||||
variant="text" color="amber" @click="useHint"
|
||||
) {{ $t('lesson.hintAction') }}
|
||||
v-btn(variant="text" color="grey" @click="phase='demo'") {{ $t('lesson.watchAgain') }}
|
||||
|
||||
@@ -122,6 +124,7 @@ const practiceCount = ref(0);
|
||||
const sessionDone = ref(0);
|
||||
const sessionTotal = ref(0);
|
||||
const canvasOpacity = ref(1);
|
||||
const loading = ref(true);
|
||||
|
||||
const canvas = ref(null);
|
||||
const demoViewer = ref(null);
|
||||
@@ -163,6 +166,7 @@ async function handleDrawComplete() {
|
||||
await new Promise((r) => { setTimeout(r, 300); });
|
||||
|
||||
subPhase.value = 'practice';
|
||||
await nextTick();
|
||||
canvas.value?.reset();
|
||||
|
||||
canvasOpacity.value = 1;
|
||||
@@ -186,9 +190,25 @@ async function handleDrawComplete() {
|
||||
function handleMistake() {
|
||||
if (subPhase.value === 'practice') practiceCount.value = 0;
|
||||
}
|
||||
|
||||
function useHint() {
|
||||
canvas.value?.showHint();
|
||||
if (subPhase.value === 'practice') {
|
||||
practiceCount.value = 0;
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
loading.value = true;
|
||||
await store.fetchLessonQueue();
|
||||
sessionTotal.value = store.lessonQueue.length;
|
||||
loadNext();
|
||||
loading.value = false;
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.page-container-center {
|
||||
min-height: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
<template lang="pug">
|
||||
v-container.fill-height.justify-center.pa-4
|
||||
v-container.fill-height.justify-center.pa-4.review-view-container
|
||||
v-fade-transition(mode="out-in")
|
||||
v-card.pa-6.rounded-xl.elevation-10.d-flex.flex-column.align-center.review-card(
|
||||
v-if="currentItem"
|
||||
.d-flex.flex-column.justify-center.align-center.fill-height(v-if="loading")
|
||||
v-progress-circular(indeterminate color="primary" size="64")
|
||||
.text-body-1.text-grey.mt-4 {{ $t('review.loading') }}
|
||||
|
||||
v-card.pa-6.rounded-xl.d-flex.flex-column.align-center.review-card(
|
||||
v-else-if="currentItem"
|
||||
)
|
||||
.d-flex.align-center.w-100.mb-6
|
||||
v-btn.mr-2(
|
||||
@@ -51,19 +55,10 @@
|
||||
color="amber-lighten-1"
|
||||
prepend-icon="mdi-lightbulb-outline"
|
||||
size="small"
|
||||
:disabled="showNext || statusCode === 'hint'"
|
||||
:disabled="showNext"
|
||||
@click="triggerHint"
|
||||
) {{ $t('review.showHint') }}
|
||||
|
||||
v-btn.text-caption.font-weight-bold.opacity-80(
|
||||
variant="text"
|
||||
color="purple-lighten-2"
|
||||
prepend-icon="mdi-school-outline"
|
||||
size="small"
|
||||
:disabled="showNext"
|
||||
@click="redoLesson"
|
||||
) {{ $t('review.redoLesson') }}
|
||||
|
||||
v-sheet.d-flex.align-center.justify-center(
|
||||
width="100%"
|
||||
height="48"
|
||||
@@ -137,6 +132,7 @@ const statusCode = ref('draw');
|
||||
const showNext = ref(false);
|
||||
const isFailure = ref(false);
|
||||
const kanjiCanvasRef = ref(null);
|
||||
const loading = ref(true);
|
||||
|
||||
const sessionTotal = ref(0);
|
||||
const sessionDone = ref(0);
|
||||
@@ -166,6 +162,7 @@ function loadNext() {
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
loading.value = true;
|
||||
const mode = route.query.mode || 'shuffled';
|
||||
await store.fetchQueue(mode);
|
||||
|
||||
@@ -173,9 +170,11 @@ onMounted(async () => {
|
||||
sessionTotal.value = store.queue.length;
|
||||
}
|
||||
loadNext();
|
||||
loading.value = false;
|
||||
});
|
||||
|
||||
async function resetSession() {
|
||||
loading.value = true;
|
||||
sessionDone.value = 0;
|
||||
sessionCorrect.value = 0;
|
||||
sessionTotal.value = 0;
|
||||
@@ -184,6 +183,7 @@ async function resetSession() {
|
||||
await store.fetchQueue(mode);
|
||||
if (store.queue.length > 0) sessionTotal.value = store.queue.length;
|
||||
loadNext();
|
||||
loading.value = false;
|
||||
}
|
||||
|
||||
watch(() => store.batchSize, async () => {
|
||||
@@ -253,3 +253,9 @@ const getStatusClass = (status) => {
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.review-view-container {
|
||||
min-height: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,21 +1,18 @@
|
||||
import { fileURLToPath, URL } from 'node:url';
|
||||
import { defineConfig } from 'vite';
|
||||
import vue from '@vitejs/plugin-vue';
|
||||
import vueDevTools from 'vite-plugin-vue-devtools';
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [vue()],
|
||||
plugins: [
|
||||
vue(),
|
||||
vueDevTools(),
|
||||
],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
||||
},
|
||||
},
|
||||
css: {
|
||||
preprocessorOptions: {
|
||||
scss: {
|
||||
additionalData: '@use "@/styles/abstracts/_variables.scss" as *; @use "@/styles/abstracts/_mixins.scss" as *;',
|
||||
},
|
||||
},
|
||||
},
|
||||
server: {
|
||||
allowedHosts: [
|
||||
'zenkanji.crylia.de',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export const PORT = process.env.PORT || 3000;
|
||||
export const MONGO_URI = process.env.MONGO_URI || 'mongodb://mongo:27017/zenkanji' || 'mongodb://192.168.0.26:27017/zenkanji';
|
||||
export const SRS_TIMINGS_HOURS = [0, 0, 4, 8, 23, 47];
|
||||
export const SRS_TIMINGS_HOURS = [0, 2, 4, 8, 23, 47];
|
||||
export const JWT_SECRET = process.env.JWT_SECRET;
|
||||
|
||||
@@ -97,7 +97,11 @@ export const processLesson = async (user, subjectId) => {
|
||||
if (!item) throw new Error('Item not found');
|
||||
|
||||
item.srsLevel = 1;
|
||||
item.nextReview = new Date();
|
||||
|
||||
const nextReview = new Date();
|
||||
nextReview.setUTCHours(nextReview.getUTCHours() + 2);
|
||||
nextReview.setUTCMinutes(0, 0, 0);
|
||||
item.nextReview = nextReview;
|
||||
|
||||
await item.save();
|
||||
return { success: true, item };
|
||||
|
||||
@@ -7,7 +7,6 @@ export const syncWithWaniKani = async (user) => {
|
||||
|
||||
console.log(`Starting sync for user: ${user._id}`);
|
||||
|
||||
// 1. Fetch all assigned Kanji Subject IDs
|
||||
let allSubjectIds = [];
|
||||
let nextUrl = 'https://api.wanikani.com/v2/assignments?subject_types=kanji&started=true';
|
||||
|
||||
@@ -26,26 +25,22 @@ export const syncWithWaniKani = async (user) => {
|
||||
|
||||
if (allSubjectIds.length === 0) return { count: 0, message: "No unlocked kanji found." };
|
||||
|
||||
// 2. Filter out items we already have
|
||||
const existingItems = await StudyItem.find({ userId: user._id }).select('wkSubjectId');
|
||||
const existingIds = new Set(existingItems.map(i => i.wkSubjectId));
|
||||
const newIds = allSubjectIds.filter(id => !existingIds.has(id));
|
||||
|
||||
console.log(`Found ${newIds.length} new items.`);
|
||||
|
||||
// 3. Process in chunks
|
||||
const CHUNK_SIZE = 50; // Reduced chunk size to accommodate secondary radical fetches
|
||||
const CHUNK_SIZE = 50;
|
||||
for (let i = 0; i < newIds.length; i += CHUNK_SIZE) {
|
||||
const chunk = newIds.slice(i, i + CHUNK_SIZE);
|
||||
|
||||
// A. Fetch Kanji Details
|
||||
const subRes = await fetch(`https://api.wanikani.com/v2/subjects?ids=${chunk.join(',')}`, {
|
||||
headers: { Authorization: `Bearer ${apiKey}` }
|
||||
});
|
||||
const subJson = await subRes.json();
|
||||
const kanjiDataList = subJson.data;
|
||||
|
||||
// B. Identify all needed Radicals
|
||||
const radicalIdsToFetch = new Set();
|
||||
kanjiDataList.forEach(k => {
|
||||
if (k.data.component_subject_ids) {
|
||||
@@ -53,11 +48,9 @@ export const syncWithWaniKani = async (user) => {
|
||||
}
|
||||
});
|
||||
|
||||
// C. Fetch Radical Details (if any)
|
||||
const radicalMap = new Map();
|
||||
if (radicalIdsToFetch.size > 0) {
|
||||
const rIds = Array.from(radicalIdsToFetch);
|
||||
// Fetch radicals in sub-chunks if necessary (max 100 per req)
|
||||
for (let j = 0; j < rIds.length; j += 100) {
|
||||
const rChunk = rIds.slice(j, j + 100);
|
||||
const rRes = await fetch(`https://api.wanikani.com/v2/subjects?ids=${rChunk.join(',')}`, {
|
||||
@@ -68,7 +61,6 @@ export const syncWithWaniKani = async (user) => {
|
||||
rJson.data.forEach(r => {
|
||||
const primaryMeaning = r.data.meanings.find(m => m.primary)?.meaning || 'Unknown';
|
||||
const char = r.data.characters;
|
||||
// Find SVG image if no character exists
|
||||
const image = !char && r.data.character_images
|
||||
? r.data.character_images.find(img => img.content_type === 'image/svg+xml' && !img.metadata.inline_styles)?.url
|
||||
: null;
|
||||
@@ -82,14 +74,12 @@ export const syncWithWaniKani = async (user) => {
|
||||
}
|
||||
}
|
||||
|
||||
// D. Build Database Objects
|
||||
const operations = kanjiDataList.map(d => {
|
||||
const readings = d.data.readings || [];
|
||||
|
||||
// Map the IDs to our fetched radical data
|
||||
const itemRadicals = (d.data.component_subject_ids || [])
|
||||
.map(rid => radicalMap.get(rid))
|
||||
.filter(Boolean); // Remove any not found
|
||||
.filter(Boolean);
|
||||
|
||||
return {
|
||||
userId: user._id,
|
||||
@@ -97,12 +87,12 @@ export const syncWithWaniKani = async (user) => {
|
||||
char: d.data.characters,
|
||||
meaning: d.data.meanings.find(m => m.primary)?.meaning || 'Unknown',
|
||||
level: d.data.level,
|
||||
srsLevel: 1,
|
||||
srsLevel: 0,
|
||||
nextReview: Date.now(),
|
||||
onyomi: readings.filter(r => r.type === 'onyomi').map(r => r.reading),
|
||||
kunyomi: readings.filter(r => r.type === 'kunyomi').map(r => r.reading),
|
||||
nanori: readings.filter(r => r.type === 'nanori').map(r => r.reading),
|
||||
radicals: itemRadicals, // Save them
|
||||
radicals: itemRadicals,
|
||||
stats: { correct: 0, total: 0 }
|
||||
};
|
||||
});
|
||||
|
||||
@@ -28,5 +28,6 @@ export const getSRSDate = (level) => {
|
||||
if (hoursToAdd === 0) return null;
|
||||
|
||||
now.setUTCHours(now.getUTCHours() + hoursToAdd);
|
||||
now.setUTCMinutes(0, 0, 0);
|
||||
return now;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user