big ui refractor

This commit is contained in:
Rene Kievits
2025-12-23 02:23:44 +01:00
parent 4428a2b7be
commit eaed23a678
62 changed files with 2662 additions and 815 deletions

1186
client/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -48,6 +48,7 @@
"stylelint": "^16.26.1", "stylelint": "^16.26.1",
"stylelint-config-recommended-vue": "^1.6.1", "stylelint-config-recommended-vue": "^1.6.1",
"stylelint-config-standard-scss": "^16.0.0", "stylelint-config-standard-scss": "^16.0.0",
"vite-plugin-vue-devtools": "^8.0.5",
"vue-eslint-parser": "^10.2.0" "vue-eslint-parser": "^10.2.0"
} }
} }

View File

@@ -1,143 +1,171 @@
<template lang="pug"> <template lang="pug">
v-app.zen-app v-app.zen-app.overflow-hidden
v-navigation-drawer( .parallax-bg(
v-model="drawer" :style="parallaxStyle"
temporary :class="{ 'zooming': viewState === 'zooming' }"
location="right"
color="#1e1e24"
class="border-none"
width="280"
) )
.d-flex.flex-column.h-100.pa-4 .bg-gradient
.d-flex.align-center.mb-6.px-2 .bg-grid
img.mr-3(:src="logo" height="32" width="32" alt="Logo")
span.text-h6.font-weight-bold {{ $t('nav.menu') }}
v-list.pa-0(nav bg-color="transparent") .kanji-layer
v-list-item.mb-2( span.bg-kanji(
to="/" v-for="(k, i) in backgroundKanjis"
rounded="lg" :key="i"
:active="$route.path === '/'" :style="k.style"
) ) {{ k.char }}
template(v-slot:prepend)
v-icon(color="#00cec9" icon="mdi-view-dashboard")
v-list-item-title.font-weight-bold {{ $t('nav.dashboard') }}
v-list-item.mb-2( .orb.orb-1(:class="{ 'zooming': viewState === 'zooming' }")
to="/collection" .orb.orb-2(:class="{ 'zooming': viewState === 'zooming' }")
rounded="lg" .orb.orb-3(:class="{ 'zooming': viewState === 'zooming' }")
:active="$route.path === '/collection'"
)
template(v-slot:prepend)
v-icon(color="#00cec9" icon="mdi-bookshelf")
v-list-item-title.font-weight-bold {{ $t('nav.collection') }}
v-divider.my-4.border-subtle .app-content-wrapper(
v-if="store.token || viewState === 'zooming'"
.d-flex.flex-column.gap-2 :class="{ 'app-entering': viewState === 'zooming', 'app-visible': viewState === 'app' }"
v-btn.justify-start.px-4(
variant="text"
block
color="grey-lighten-1"
@click="showSettings = true; drawer = false"
)
v-icon(start icon="mdi-cog")
| {{ $t('nav.settings') }}
v-btn.justify-start.px-4(
variant="text"
block
color="grey-lighten-1"
:loading="syncing"
@click="manualSync"
)
v-icon(start icon="mdi-sync")
| {{ $t('nav.sync') }}
v-btn.justify-start.px-4.text-red-lighten-2(
variant="text"
block
@click="handleLogout"
)
v-icon(start icon="mdi-logout")
| {{ $t('nav.logout') }}
v-app-bar.px-2.app-bar-blur.safe-area-header(
flat
color="rgba(30, 30, 36, 0.8)"
border="b"
) )
v-app-bar-title.font-weight-bold.text-h6(style="min-width: fit-content;") v-navigation-drawer(
.d-flex.align-center.cursor-pointer.logo-hover(@click="$router.push('/')") v-model="drawer"
img(:src="logo" height="32" width="32" alt="Zen Kanji Logo") temporary
span.ml-3.tracking-tight Zen Kanji location="right"
color="#1e1e24"
class="border-none"
width="280"
)
.d-flex.flex-column.h-100.pa-4
.d-flex.align-center.mb-6.px-2
img.mr-3(:src="logo" height="32" width="32" alt="Logo")
span.text-h6.font-weight-bold {{ $t('nav.menu') }}
v-spacer v-list.pa-0(nav bg-color="transparent")
v-list-item.mb-2(
to="/"
rounded="lg"
:active="$route.path === '/'"
)
template(v-slot:prepend)
v-icon(color="#00cec9" icon="mdi-view-dashboard")
v-list-item-title.font-weight-bold {{ $t('nav.dashboard') }}
template(v-if="store.token") v-list-item.mb-2(
.d-none.d-md-flex.align-center to="/collection"
v-btn.mx-1( rounded="lg"
to="/" :active="$route.path === '/collection'"
:active="false" )
variant="text" template(v-slot:prepend)
:color="$route.path === '/' ? '#00cec9' : 'grey'" v-icon(color="#00cec9" icon="mdi-bookshelf")
) {{ $t('nav.dashboard') }} v-list-item-title.font-weight-bold {{ $t('nav.collection') }}
v-btn.mx-1( v-divider.my-4.border-subtle
to="/collection"
:active="false"
variant="text"
:color="$route.path === '/collection' ? '#00cec9' : 'grey'"
) {{ $t('nav.collection') }}
v-divider.mx-2.my-auto(vertical length="20" color="grey-darken-2") .d-flex.flex-column.gap-2
v-btn.justify-start.px-4(
variant="text"
block
color="grey-lighten-1"
@click="showSettings = true; drawer = false"
)
v-icon(start icon="mdi-cog")
| {{ $t('nav.settings') }}
v-tooltip(:text="$t('nav.settings')" location="bottom") v-btn.justify-start.px-4(
template(v-slot:activator="{ props }") variant="text"
v-btn( block
v-bind="props" color="grey-lighten-1"
icon="mdi-cog" :loading="syncing"
variant="text" @click="manualSync"
color="grey-lighten-1" )
@click="showSettings = true" v-icon(start icon="mdi-sync")
) | {{ $t('nav.sync') }}
v-tooltip(:text="$t('nav.sync')" location="bottom") v-btn.justify-start.px-4.text-red-lighten-2(
template(v-slot:activator="{ props }") variant="text"
v-btn( block
v-bind="props" @click="handleLogout"
icon="mdi-sync" )
variant="text" v-icon(start icon="mdi-logout")
:loading="syncing" | {{ $t('nav.logout') }}
color="grey-lighten-1"
@click="manualSync"
)
v-tooltip(:text="$t('nav.logout')" location="bottom") v-app-bar.px-2.app-bar-blur.safe-area-header(
template(v-slot:activator="{ props }") flat
v-btn( color="rgba(30, 30, 36, 0.8)"
v-bind="props" border="b"
icon="mdi-logout" )
variant="text" v-app-bar-title.font-weight-bold.text-h6(style="min-width: fit-content;")
color="grey-darken-1" .d-flex.align-center.cursor-pointer.logo-hover(@click="$router.push('/')")
@click="handleLogout" img(:src="logo" height="32" width="32" alt="Zen Kanji Logo")
) span.ml-3.tracking-tight Zen Kanji
.d-flex.d-md-none v-spacer
v-btn(
icon="mdi-menu"
variant="text"
color="grey-lighten-1"
@click="drawer = !drawer"
)
v-main template(v-if="store.token")
.fill-height.d-flex.align-center.justify-center.px-4(v-if="!store.token") .d-none.d-md-flex.align-center
v-card.pa-6.rounded-lg.elevation-10.text-center.border-subtle( v-btn.mx-1(
color="#1e1e24" to="/"
width="100%" variant="text"
max-width="400" :color="$route.path === '/' ? '#00cec9' : 'grey'"
) ) {{ $t('nav.dashboard') }}
v-btn.mx-1(
to="/collection"
variant="text"
:color="$route.path === '/collection' ? '#00cec9' : 'grey'"
) {{ $t('nav.collection') }}
v-divider.mx-2.my-auto(vertical length="20" color="grey-darken-2")
v-tooltip(:text="$t('nav.settings')" location="bottom")
template(v-slot:activator="{ props }")
v-btn(
v-bind="props"
icon="mdi-cog"
variant="text"
color="grey-lighten-1"
@click="showSettings = true"
)
v-tooltip(:text="$t('nav.sync')" location="bottom")
template(v-slot:activator="{ props }")
v-btn(
v-bind="props"
icon="mdi-sync"
variant="text"
:loading="syncing"
color="grey-lighten-1"
@click="manualSync"
)
v-tooltip(:text="$t('nav.logout')" location="bottom")
template(v-slot:activator="{ props }")
v-btn(
v-bind="props"
icon="mdi-logout"
variant="text"
color="grey-darken-1"
@click="handleLogout"
)
.d-flex.d-md-none
v-btn(
icon="mdi-menu"
variant="text"
color="grey-lighten-1"
@click="drawer = !drawer"
)
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") img.mb-4(:src="logo" height="64" width="64")
h1.text-h5.font-weight-bold.mb-2 {{ $t('hero.welcome') }} h1.text-h5.font-weight-bold.mb-2 {{ $t('hero.welcome') }}
@@ -151,7 +179,8 @@
color="white" color="white"
hide-details hide-details
density="comfortable" density="comfortable"
@keyup.enter="handleLogin" @keyup.enter="triggerLogin"
:disabled="viewState === 'authenticating' || viewState === 'zooming'"
) )
v-alert.mb-4.text-left.text-caption( v-alert.mb-4.text-left.text-caption(
@@ -161,16 +190,14 @@
variant="tonal" variant="tonal"
) {{ errorMsg }} ) {{ errorMsg }}
v-btn.text-black.font-weight-bold.mt-4( v-btn.text-black.font-weight-bold.mt-4.login-btn(
block block
color="#00cec9" color="#00cec9"
height="44" height="44"
:loading="loggingIn" :loading="viewState === 'authenticating'"
@click="handleLogin" @click="triggerLogin"
) {{ $t('login.button') }} ) {{ $t('login.button') }}
router-view(v-else)
v-dialog(v-model="showSettings" max-width="340") v-dialog(v-model="showSettings" max-width="340")
v-card.rounded-xl.pa-4.border-subtle(color="#1e1e24") v-card.rounded-xl.pa-4.border-subtle(color="#1e1e24")
v-card-title.text-center.font-weight-bold {{ $t('settings.title') }} v-card-title.text-center.font-weight-bold {{ $t('settings.title') }}
@@ -205,15 +232,15 @@
span {{ $t('settings.loose') }} (20) span {{ $t('settings.loose') }} (20)
.text-caption.text-grey.mb-2 {{ $t('settings.language') }} .text-caption.text-grey.mb-2 {{ $t('settings.language') }}
v-btn-toggle.d-flex.w-100.border-subtle(
v-model="$i18n.locale" .lang-switch-wrapper.border-subtle.mb-2
mandatory .lang-glider(:style="{ transform: `translateX(${localeIndex * 100}%)` }")
rounded="lg" button.lang-btn(
color="#00cec9" v-for="l in availableLocales"
) :key="l"
v-btn.flex-grow-1(value="en") EN :class="{ 'active': tempLocale === l }"
v-btn.flex-grow-1(value="de") DE @click="tempLocale = l"
v-btn.flex-grow-1(value="ja") JA ) {{ l.toUpperCase() }}
v-card-actions.mt-2 v-card-actions.mt-2
v-btn.text-white( v-btn.text-white(
@@ -256,7 +283,9 @@
<script setup> <script setup>
/* eslint-disable no-unused-vars */ /* 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 { useI18n } from 'vue-i18n';
import { useAppStore } from '@/stores/appStore'; import { useAppStore } from '@/stores/appStore';
import logo from '@/assets/icon.svg'; import logo from '@/assets/icon.svg';
@@ -265,8 +294,10 @@ const drawer = ref(false);
const { locale, t } = useI18n(); const { locale, t } = useI18n();
const store = useAppStore(); const store = useAppStore();
const viewState = ref('login');
const mousePos = ref({ x: 0, y: 0 });
const inputKey = ref(''); const inputKey = ref('');
const loggingIn = ref(false);
const syncing = ref(false); const syncing = ref(false);
const errorMsg = ref(''); const errorMsg = ref('');
const showSettings = ref(false); const showSettings = ref(false);
@@ -276,16 +307,114 @@ const snackbar = ref({ show: false, text: '', color: 'success' });
const tempBatchSize = ref(store.batchSize); const tempBatchSize = ref(store.batchSize);
const tempDrawingAccuracy = ref(store.drawingAccuracy); 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(() => { onMounted(() => {
if (store.token) { if (store.token) {
viewState.value = 'app';
store.fetchStats(); 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) => { watch(showSettings, (isOpen) => {
if (isOpen) { if (isOpen) {
tempBatchSize.value = store.batchSize; tempBatchSize.value = store.batchSize;
tempDrawingAccuracy.value = store.drawingAccuracy; 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; if (!inputKey.value) return;
loggingIn.value = true; viewState.value = 'authenticating';
errorMsg.value = ''; errorMsg.value = '';
try { try {
const result = await store.login(inputKey.value.trim()); const result = await store.login(inputKey.value.trim());
if (result.user && !result.user.lastSync) {
manualSync(); // 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) { } catch (e) {
console.error(e); console.error(e);
errorMsg.value = e.message || t('login.failed'); errorMsg.value = e.message || t('login.failed');
} finally { viewState.value = 'login';
loggingIn.value = false;
} }
} }
function saveSettings() { function saveSettings() {
store.saveSettings({
batchSize: tempBatchSize.value,
drawingAccuracy: tempDrawingAccuracy.value,
});
localStorage.setItem('zen_locale', locale.value);
showSettings.value = false; showSettings.value = false;
store.fetchQueue();
setTimeout(() => {
if (locale.value !== tempLocale.value) {
locale.value = tempLocale.value;
localStorage.setItem('zen_locale', locale.value);
}
store.saveSettings({
batchSize: tempBatchSize.value,
drawingAccuracy: tempDrawingAccuracy.value,
});
store.fetchQueue();
}, 300);
} }
function handleLogout() { function handleLogout() {
showLogoutDialog.value = true; showLogoutDialog.value = true;
drawer.value = false; drawer.value = false;
} }
function confirmLogout() { function confirmLogout() {
store.logout(); store.logout();
inputKey.value = ''; inputKey.value = '';
showLogoutDialog.value = false; showLogoutDialog.value = false;
viewState.value = 'login';
} }
</script> </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> .parallax-bg {
.safe-area-header { position: fixed;
padding-top: env(safe-area-inset-top); 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) { .bg-grid {
min-height: 64px; position: absolute;
align-items: center; 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> </style>

View File

@@ -1,5 +1,5 @@
<template lang="pug"> <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" color="#1e1e24"
flat flat
) )
@@ -38,5 +38,3 @@ const props = defineProps({
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
const hasHeader = computed(() => !!props.title || !!props.icon || !!props.subtitle); const hasHeader = computed(() => !!props.title || !!props.icon || !!props.subtitle);
</script> </script>
<style lang="scss" src="@/styles/components/_widgets.scss" scoped></style>

View File

@@ -35,5 +35,3 @@ const accuracyPercent = computed(() => {
return Math.round((props.accuracy.correct / props.accuracy.total) * 100); return Math.round((props.accuracy.correct / props.accuracy.total) * 100);
}); });
</script> </script>
<style lang="scss" src="@/styles/components/_widgets.scss" scoped></style>

View File

@@ -59,5 +59,3 @@ const toRoman = (num) => {
return lookup[num] || num; return lookup[num] || num;
}; };
</script> </script>
<style lang="scss" src="@/styles/components/_widgets.scss" scoped></style>

View File

@@ -29,5 +29,3 @@ const props = defineProps({
const hasUpcoming = computed(() => props.forecast && props.forecast.some((c) => c > 0)); const hasUpcoming = computed(() => props.forecast && props.forecast.some((c) => c > 0));
</script> </script>
<style lang="scss" src="@/styles/components/_widgets.scss" scoped></style>

View File

@@ -35,5 +35,3 @@ const props = defineProps({
ghosts: { type: Array, default: () => [] }, ghosts: { type: Array, default: () => [] },
}); });
</script> </script>
<style lang="scss" src="@/styles/components/_widgets.scss" scoped></style>

View File

@@ -39,5 +39,3 @@ const masteryPercent = computed(
() => (totalItems.value === 0 ? 0 : Math.round((masteredCount.value / totalItems.value) * 100)), () => (totalItems.value === 0 ? 0 : Math.round((masteredCount.value / totalItems.value) * 100)),
); );
</script> </script>
<style lang="scss" src="@/styles/components/_widgets.scss" scoped></style>

View File

@@ -78,5 +78,3 @@ const getHeatmapClass = (count) => {
const formatDate = (dateStr) => new Date(dateStr).toLocaleDateString(locale.value, { month: 'short', day: 'numeric' }); const formatDate = (dateStr) => new Date(dateStr).toLocaleDateString(locale.value, { month: 'short', day: 'numeric' });
const isToday = (dateStr) => dateStr === new Date().toISOString().split('T')[0]; const isToday = (dateStr) => dateStr === new Date().toISOString().split('T')[0];
</script> </script>
<style lang="scss" src="@/styles/components/_widgets.scss" scoped></style>

View File

@@ -58,5 +58,3 @@ const getDayLabel = (dateStr) => {
return new Date(dateStr).toLocaleDateString(locale.value, { weekday: 'short' }); return new Date(dateStr).toLocaleDateString(locale.value, { weekday: 'short' });
}; };
</script> </script>
<style lang="scss" src="@/styles/components/_widgets.scss" scoped></style>

View File

@@ -1,53 +1,72 @@
<template lang="pug"> <template lang="pug">
.grid-area-full.text-center.mb-4 .grid-area-full.text-center.mb-8.zen-wrapper
.text-h2.font-weight-bold.mb-2 {{ $t('hero.welcome') }} .text-h3.font-weight-bold.mb-2.text-white.letter-spacing-small {{ $t('hero.welcome') }}
.text-h5.text-grey.mb-8 {{ $t('hero.subtitle') }} .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 .d-flex.justify-center.align-stretch.flex-wrap.ga-6.mb-8
v-btn.text-h5.font-weight-bold.text-black.glow-btn.welcome-btn(
v-btn.zen-btn.lesson-btn(
v-if="lessonCount > 0" v-if="lessonCount > 0"
to="/lesson" to="/lesson"
rounded="xl" rounded="xl"
color="purple-accent-2" 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
| {{ $t('hero.lessons') }} v-icon.mr-5(size="36" icon="mdi-school-outline")
v-chip.ml-3.font-weight-bold(
color="#1e1e24" .d-flex.flex-column.align-start.mr-auto
variant="flat" .text-purple-lighten-1.text-h6.font-weight-bold.line-height-tight
size="default" | {{ $t('hero.lessons') }}
style="color: white !important;" .text-purple-accent-1.text-caption.font-weight-regular.opacity-80
) {{ lessonCount }} | {{ $t('hero.newContent') }}
v-btn.text-h5.font-weight-bold.text-black.glow-btn.welcome-btn(
.zen-counter.bg-purple-accent-2.text-black.ml-4
| {{ lessonCount }}
v-btn.zen-btn.review-btn(
@click="$emit('start', 'shuffled')" @click="$emit('start', 'shuffled')"
rounded="xl" rounded="xl"
color="#00cec9" color="cyan-accent-2"
variant="tonal"
size="x-large"
height="80"
:disabled="queueLength === 0" :disabled="queueLength === 0"
:class="{ 'zen-disabled': queueLength === 0 }"
) )
v-icon(size="32" start) mdi-brush .d-flex.align-center.w-100.px-2.zen-btn-content
| {{ queueLength > 0 ? $t('hero.start') : $t('hero.noReviews') }} v-icon.mr-5(size="36" icon="mdi-brush-variant")
v-chip.ml-3.font-weight-bold( .d-flex.flex-column.align-start.mr-auto
v-if="queueLength > 0" .text-cyan-lighten-1.text-h6.font-weight-bold.line-height-tight
color="#1e1e24" | {{ queueLength > 0 ? $t('hero.start') : $t('hero.noReviews') }}
variant="flat" .text-cyan-accent-1.text-caption.font-weight-regular.opacity-80
size="default" | {{ queueLength > 0 ? $t('hero.readyToReview') : $t('hero.allCaughtUp') }}
style="color: white !important;"
) {{ queueLength }}
v-fade-transition
.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-fade-transition
v-btn.mt-4.text-caption.font-weight-bold( v-btn.text-caption.font-weight-bold.text-uppercase.letter-spacing-1.text-grey(
v-if="hasLowerLevels" v-if="hasLowerLevels"
@click="$emit('start', 'priority')" @click="$emit('start', 'priority')"
variant="plain" variant="text"
color="grey-lighten-1"
prepend-icon="mdi-sort-ascending" prepend-icon="mdi-sort-ascending"
:ripple="false" :ripple="false"
) {{ $t('hero.prioritize', { count: lowerLevelCount }) }} ) {{ $t('hero.prioritize', { count: lowerLevelCount }) }}
.text-caption.text-grey.mt-2(v-if="queueLength === 0") v-fade-transition
| {{ $t('hero.nextIn') }} {{ nextReviewTime }} .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> </template>
<script setup> <script setup>
@@ -67,9 +86,11 @@ defineEmits(['start']);
const { t } = useI18n(); const { t } = useI18n();
const nextReviewTime = computed(() => { const nextReviewTime = computed(() => {
if (!props.forecast) return 'a while'; if (!props.forecast || Object.keys(props.forecast).length === 0) return null;
const idx = props.forecast.findIndex((c) => c > 0); try {
if (idx === -1) return 'a while'; const idx = props.forecast.findIndex((c) => c > 0);
return idx === 0 ? t('hero.now') : t('stats.inHours', { n: idx }, idx); if (idx === -1) return null;
return idx === 0 ? t('hero.now') : t('stats.inHours', { n: idx }, idx);
} catch (e) { return null; }
}); });
</script> </script>

View File

@@ -121,6 +121,7 @@ watch(() => props.char, (newChar) => {
watch(() => props.autoHint, (shouldHint) => { watch(() => props.autoHint, (shouldHint) => {
if (!controller) return; if (!controller) return;
controller.setAutoHint(shouldHint);
if (shouldHint) controller.showHint(); if (shouldHint) controller.showHint();
}); });

View File

@@ -58,6 +58,7 @@ const props = defineProps({
default: 'animate', default: 'animate',
validator: (v) => ['hero', 'animate'].includes(v), validator: (v) => ['hero', 'animate'].includes(v),
}, },
svgContent: { type: String, default: '' },
}); });
const strokes = ref([]); const strokes = ref([]);
@@ -72,10 +73,14 @@ async function loadData(char) {
const hex = char.charCodeAt(0).toString(16).padStart(5, '0'); const hex = char.charCodeAt(0).toString(16).padStart(5, '0');
try { try {
const baseUrl = 'https://raw.githubusercontent.com/KanjiVG/kanjivg/master/kanji'; let txt = props.svgContent;
const res = await fetch(`${baseUrl}/${hex}.svg`);
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 parser = new DOMParser();
const doc = parser.parseFromString(txt, 'image/svg+xml'); const doc = parser.parseFromString(txt, 'image/svg+xml');
const rawPaths = Array.from(doc.getElementsByTagName('path')).map((p) => p.getAttribute('d')); 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); }); onMounted(() => { if (props.char) loadData(props.char); });
watch(() => props.char, (n) => { if (n) loadData(n); }); watch(() => props.char, (n) => { if (n) loadData(n); });
</script> </script>
<style lang="scss" src="@/styles/components/_kanji.scss" scoped></style>

View File

@@ -50,10 +50,13 @@ const messages = {
}, },
hero: { hero: {
lessons: 'Lessons', lessons: 'Lessons',
newContent: 'New content available',
welcome: 'Welcome Back', welcome: 'Welcome Back',
subtitle: 'Your mind is ready.', subtitle: 'Your mind is ready.',
start: 'Start Review', start: 'Start Review',
readyToReview: 'Ready to review',
noReviews: 'No Reviews', noReviews: 'No Reviews',
allCaughtUp: 'All caught up',
nextIn: 'Next review in', nextIn: 'Next review in',
now: 'now', now: 'now',
prioritize: 'Prioritize Lower Levels ({count})', prioritize: 'Prioritize Lower Levels ({count})',
@@ -177,10 +180,13 @@ const messages = {
}, },
hero: { hero: {
lessons: 'Lektionen', lessons: 'Lektionen',
newContent: 'Neue Inhalte verfügbar',
welcome: 'Willkommen zurück', welcome: 'Willkommen zurück',
subtitle: 'Dein Geist ist bereit.', subtitle: 'Dein Geist ist bereit.',
start: 'Starten', start: 'Starten',
readyToReview: 'Bereit zum Wiederholen',
noReviews: 'Alles erledigt', noReviews: 'Alles erledigt',
allCaughtUp: 'Alles auf dem neuesten Stand',
nextIn: 'Nächste Review in', nextIn: 'Nächste Review in',
now: 'jetzt', now: 'jetzt',
prioritize: 'Niedrige Stufen zuerst ({count})', prioritize: 'Niedrige Stufen zuerst ({count})',
@@ -304,10 +310,13 @@ const messages = {
}, },
hero: { hero: {
lessons: 'レッスン', lessons: 'レッスン',
newContent: '新しいコンテンツがあります',
welcome: 'お帰りなさい', welcome: 'お帰りなさい',
subtitle: '準備は完了です。', subtitle: '準備は完了です。',
start: '復習開始', start: '復習開始',
readyToReview: '復習の準備ができています',
noReviews: 'レビューなし', noReviews: 'レビューなし',
allCaughtUp: 'すべて完了しています',
nextIn: '次の復習まで', nextIn: '次の復習まで',
now: '今', now: '今',
prioritize: '低レベルを優先 ({count})', prioritize: '低レベルを優先 ({count})',

View File

@@ -41,7 +41,6 @@ export const useAppStore = defineStore('app', {
this.batchSize = data.user.settings.batchSize || 20; this.batchSize = data.user.settings.batchSize || 20;
this.drawingAccuracy = data.user.settings.drawingAccuracy || 10; this.drawingAccuracy = data.user.settings.drawingAccuracy || 10;
// Persist settings to local storage on login
localStorage.setItem('zen_batch_size', this.batchSize); localStorage.setItem('zen_batch_size', this.batchSize);
localStorage.setItem('zen_drawing_accuracy', this.drawingAccuracy); localStorage.setItem('zen_drawing_accuracy', this.drawingAccuracy);
} }

View File

@@ -1,5 +1,6 @@
@forward 'variables/colors'; @forward 'variables/colors';
@forward 'variables/typography'; @forward 'variables/typography';
@forward 'variables/spacing'; @forward 'variables/spacings';
@forward 'variables/layout'; @forward 'variables/layout';
@forward 'variables/effects'; @forward 'variables/effects';
@forward 'mixins';

View File

@@ -13,12 +13,11 @@
gap: $gap; gap: $gap;
} }
@mixin grid-responsive($min-width: 960px) { @mixin grid-responsive($min-width: $breakpoint-md) {
display: grid; display: grid;
grid-template-columns: 1fr; grid-template-columns: 1fr;
@media (min-width: $min-width) { @media (min-width: $min-width) {
// stylelint-disable-next-line no-invalid-position-declaration
grid-template-columns: 1fr 1fr; grid-template-columns: 1fr 1fr;
} }
} }
@@ -26,7 +25,7 @@
@mixin card-base { @mixin card-base {
background: $color-surface-light; background: $color-surface-light;
border-radius: $radius-md; border-radius: $radius-md;
border: 1px solid transparent; border: $border-width-sm solid transparent;
background-clip: padding-box; background-clip: padding-box;
} }
@@ -40,7 +39,7 @@
backface-visibility: hidden; backface-visibility: hidden;
&:hover { &:hover {
transform: translateY(-2px); transform: translateY(-0.125rem);
background: color.adjust($color-surface-light, $lightness: 5%); background: color.adjust($color-surface-light, $lightness: 5%);
box-shadow: $shadow-md; box-shadow: $shadow-md;
} }
@@ -48,7 +47,7 @@
@mixin scrollbar { @mixin scrollbar {
scrollbar-width: thin; scrollbar-width: thin;
scrollbar-color: #333 transparent; scrollbar-color: $color-stroke-inactive transparent;
} }
@mixin animate-fade-up($duration: 0.4s) { @mixin animate-fade-up($duration: 0.4s) {
@@ -57,9 +56,8 @@
@keyframes fade-slide-up { @keyframes fade-slide-up {
from { from {
opacity: 0; opacity: 0;
transform: translateY(10px); transform: translateY(0.625rem);
} }
to { to {
opacity: 1; opacity: 1;
transform: translateY(0); transform: translateY(0);

View File

@@ -1,14 +1,35 @@
$color-primary: hsl(178deg 100% 40%); $color-primary: hsl(178deg 100% 40%);
$color-secondary: hsl(46deg 100% 82%); $color-secondary: hsl(46deg 100% 82%);
$color-bg-dark: hsl(0deg 0% 7%); $color-bg-dark: hsl(0deg 0% 7%);
$color-surface: hsl(240deg 9% 13%); $color-surface: hsl(240deg 9% 13%);
$color-surface-light: hsl(221deg 17% 22%); $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-white: hsl(0deg 0% 100%);
$color-text-grey: hsl(213deg 14% 70%); $color-text-grey: hsl(213deg 14% 70%);
$color-text-dark: hsl(0deg 0% 0%);
$color-border: hsl(0deg 0% 100% / 8%); $color-border: hsl(0deg 0% 100% / 8%);
$color-zinc-900: #18181b; $color-danger: hsl(0deg 85% 65%);
$color-reading-box: rgb(255 255 255 / 3%); $color-success: hsl(160deg 80% 45%);
$color-stroke-drawn: #a1a1aa; $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-1: hsl(0deg 100% 73%);
$color-srs-2: hsl(39deg 98% 71%); $color-srs-2: hsl(39deg 98% 71%);
$color-srs-3: hsl(163deg 85% 64%); $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-7: $color-primary;
$color-srs-8: hsl(339deg 97% 73%); $color-srs-8: hsl(339deg 97% 73%);
$color-srs-9: hsl(331deg 78% 59%); $color-srs-9: hsl(331deg 78% 59%);
$color-srs-10: hsl(51deg 100% 50%); $color-srs-10: $color-gold;
$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%);
$srs-colors: ( $srs-colors: (
1: $color-srs-1, 1: $color-srs-1,
2: $color-srs-2, 2: $color-srs-2,

View File

@@ -5,26 +5,39 @@ $opacity-disabled: 0.5;
$opacity-inactive: 0.3; $opacity-inactive: 0.3;
$opacity-hover: 0.8; $opacity-hover: 0.8;
$opacity-active: 1; $opacity-active: 1;
$opacity-kanji-hint: 0.5;
$blur-sm: blur(4px); $blur-sm: blur(4px);
$blur-md: blur(10px); $blur-md: blur(10px);
$blur-lg: blur(20px); $blur-lg: blur(20px);
$bg-glass-subtle: hsl(0deg 0% 100% / 5%); $bg-glass-subtle: hsl(0deg 0% 100% / 5%);
$bg-glass-light: hsl(0deg 0% 100% / 6%); $bg-glass-light: hsl(0deg 0% 100% / 6%);
$bg-glass-strong: hsl(0deg 0% 100% / 10%); $bg-glass-strong: hsl(0deg 0% 100% / 10%);
$bg-glass-dark: hsl(0deg 0% 0% / 20%); $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-color-base: hsl(0deg 0% 0% / 20%);
$shadow-lg: 0 20px 50px hsl(0deg 0% 0% / 50%); $shadow-color-dark: hsl(0deg 0% 0% / 30%);
$shadow-inset: inset 0 0 20px hsl(0deg 0% 0% / 30%); $shadow-color-darker: hsl(0deg 0% 0% / 50%);
$text-shadow: 0 2px 10px hsl(0deg 0% 0% / 50%);
$shadow-glow-xs: 0 0 4px hsl(0deg 0% 100% / 50%); $shadow-sm: 0 0.125rem 0.25rem $shadow-color-base;
$shadow-glow-base: 0 0 20px color.change($color-primary, $alpha: 0.4); $shadow-md: 0 0.25rem 0.9375rem $shadow-color-dark;
$shadow-glow-hover: 0 0 40px color.change($color-primary, $alpha: 0.6); $shadow-lg: 0 1.25rem 3.125rem $shadow-color-darker;
$shadow-glow-active: 0 0 20px color.change($color-primary, $alpha: 0.4); $shadow-inset: inset 0 0 1.25rem $shadow-color-dark;
$dist-slide-sm: 10px; $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-fast: 0.2s;
$duration-normal: 0.3s; $duration-normal: 0.3s;
$duration-slow: 0.5s; $duration-slow: 0.5s;
$duration-chart: 1s; $duration-chart: 1s;
$ease-default: ease; $ease-default: ease;
$ease-out-back: cubic-bezier(0.175, 0.885, 0.32, 1.275); $ease-out-back: cubic-bezier(0.175, 0.885, 0.32, 1.275);

View File

@@ -0,0 +1,5 @@
@forward 'colors';
@forward 'typography';
@forward 'spacings';
@forward 'layout';
@forward 'effects';

View File

@@ -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; $padding-page-y: 2.5rem;
$radius-md: 8px; $padding-page-x: 1.5rem;
$radius-lg: 12px;
$radius-xl: 24px; $radius-xs: 0.125rem;
$radius-pill: 999px; $radius-sm: 0.25rem;
$radius-md: 0.5rem;
$radius-lg: 0.75rem;
$radius-xl: 1.5rem;
$radius-pill: 62.4375rem;
$radius-circle: 50%; $radius-circle: 50%;
$border-width-sm: 1px; $border-width-sm: 1px;
$border-width-md: 2px; $border-width-md: 2px;
$border-subtle: $border-width-sm solid $color-border;
$border-focus: $border-width-md solid $color-primary; $size-icon-btn: 2rem;
$border-transparent: $border-width-md solid transparent; $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-back: -1;
$z-normal: 1; $z-normal: 1;
$z-above: 2;
$z-play-btn: 10;
$z-sticky: 10; $z-sticky: 10;
$z-dropdown: 50; $z-dropdown: 50;
$z-modal: 100; $z-modal: 100;
$z-tooltip: 200; $z-tooltip: 200;
$z-above: 2;
// Neue Z-Indizes aus dem Refactoring $offset-fab: 1.25rem;
$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;

View File

@@ -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;

View 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;

View File

@@ -4,6 +4,7 @@ $font-family-sans:
-apple-system, -apple-system,
sans-serif; sans-serif;
$font-family-mono: 'Fira Code', monospace; $font-family-mono: 'Fira Code', monospace;
$font-xs: 0.75rem; $font-xs: 0.75rem;
$font-sm: 0.875rem; $font-sm: 0.875rem;
$font-md: 1rem; $font-md: 1rem;
@@ -11,15 +12,22 @@ $font-lg: 1.25rem;
$font-xl: 1.5rem; $font-xl: 1.5rem;
$font-2xl: 2rem; $font-2xl: 2rem;
$font-3xl: 3rem; $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-regular: 400;
$weight-medium: 500; $weight-medium: 500;
$weight-bold: 700; $weight-bold: 700;
$weight-black: 900; $weight-black: 900;
$tracking-tighter: -0.05em; $tracking-tighter: -0.05em;
$tracking-tight: -0.025em; $tracking-tight: -0.025em;
$tracking-normal: 0em; $tracking-normal: 0em;
$tracking-wide: 0.025em; $tracking-wide: 0.025em;
$tracking-wider: 0.05em; $tracking-wider: 0.05em;
$leading-tight: 1.2; $leading-tight: 1.2;
$leading-normal: 1.5; $leading-normal: 1.5;
$leading-loose: 1.8; $leading-loose: 1.8;

View File

@@ -1,8 +1,9 @@
@use '../abstracts/variables' as *; @use '../abstracts' as *;
:root { :root {
--v-theme-background: #{$color-bg-dark}; --color-background: #{$color-bg-dark};
--color-surface: #{$color-surface}; --color-surface: #{$color-surface};
--color-primary: #{$color-primary};
@each $level, $color in $srs-colors { @each $level, $color in $srs-colors {
--srs-#{$level}: #{$color}; --srs-#{$level}: #{$color};
@@ -16,31 +17,14 @@ html,
background-color: $color-bg-dark !important; background-color: $color-bg-dark !important;
font-family: $font-family-sans; font-family: $font-family-sans;
color: $color-text-white; color: $color-text-white;
} -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
.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;
}
}
} }
.v-card { .v-card {
box-shadow: $shadow-lg !important; box-shadow: $shadow-lg !important;
} }
.app-bar-blur {
border-bottom-color: $color-border !important;
backdrop-filter: $blur-md;
}
.cursor-pointer { .cursor-pointer {
cursor: pointer; cursor: pointer;
} }
@@ -54,15 +38,7 @@ html,
} }
.border-subtle { .border-subtle {
border: $border-subtle; border: $border-width-sm solid $color-border;
}
.logo-hover {
transition: opacity $duration-fast $ease-default;
&:hover {
opacity: $opacity-hover;
}
} }
@each $level, $color in $srs-colors { @each $level, $color in $srs-colors {
@@ -74,3 +50,20 @@ html,
background-color: var(--srs-#{$level}) !important; 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);
}

View File

@@ -0,0 +1,2 @@
@use 'typography';
@use 'base';

View File

@@ -1,4 +1,4 @@
@use '../abstracts/variables' as *; @use '../abstracts' as *;
body { body {
font-family: $font-family-sans; font-family: $font-family-sans;

View File

@@ -1,4 +1,4 @@
@use '../abstracts/variables' as *; @use '../abstracts' as *;
.glow-btn { .glow-btn {
box-shadow: $shadow-glow-base; box-shadow: $shadow-glow-base;
@@ -8,7 +8,7 @@
will-change: transform, box-shadow; will-change: transform, box-shadow;
&:hover { &:hover {
transform: translateY(-2px); transform: translateY(-0.125rem);
box-shadow: $shadow-glow-hover; box-shadow: $shadow-glow-hover;
} }
@@ -24,3 +24,46 @@
cursor: not-allowed; 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;
}
}

View 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;
}

View File

@@ -0,0 +1,4 @@
@use 'buttons';
@use 'cards';
@use 'kanji/index' as kanji;
@use 'dashboard/index' as dashboard;

View File

@@ -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;
}
}

View File

@@ -0,0 +1,8 @@
@use '../../abstracts' as *;
.accuracy-chart-wrapper {
position: relative;
display: flex;
align-items: center;
justify-content: center;
}

View File

@@ -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;
}

View File

@@ -0,0 +1,6 @@
@use '../../abstracts' as *;
.forecast-list {
overflow-y: auto;
@include scrollbar;
}

View 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;
}

View File

@@ -0,0 +1,6 @@
@use '../../abstracts' as *;
.mastery-progress {
width: 100%;
margin-top: $spacing-sm;
}

View 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;
}

View 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;
}
}

View 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;
}

View 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';

View File

@@ -0,0 +1,2 @@
@use 'kanji-canvas';
@use 'kanji-svg-viewer';

View 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;
}

View File

@@ -1,7 +1,19 @@
@use '../abstracts/variables' as *; @use '../../abstracts' as *;
@use '../abstracts/mixins' 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, &::before,
&::after { &::after {
content: ''; content: '';
@@ -15,78 +27,26 @@
&::before { &::before {
top: 50%; top: 50%;
left: 10px; left: $size-play-btn-offset;
right: 10px; right: $size-play-btn-offset;
border-top-width: 1px; border-top-width: $border-width-sm;
} }
&::after { &::after {
left: 50%; left: 50%;
top: 10px; top: $size-play-btn-offset;
bottom: 10px; bottom: $size-play-btn-offset;
border-left-width: 1px; 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 { &.hero-mode {
background: linear-gradient(145deg, $color-surface, #18181b); background: linear-gradient(145deg, $color-surface, $color-zinc-900);
border: 2px solid $color-border; border: $border-width-md solid $color-border;
box-shadow: 0 4px 20px rgb(0 0 0 / 40%); box-shadow: 0 0.25rem 1.25rem hsl(0deg 0% 0% / 40%);
.stroke-path.drawn { .stroke-path.drawn {
stroke: $color-text-white; 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, &::before,
@@ -110,17 +70,15 @@
stroke-linejoin: round; stroke-linejoin: round;
stroke-width: $stroke-width-main; stroke-width: $stroke-width-main;
transition: transition:
stroke 0.3s ease, stroke $duration-normal ease,
opacity 0.3s ease; opacity $duration-normal ease;
&.drawn { &.drawn {
stroke: $color-stroke-drawn; stroke: $color-stroke-drawn;
} }
&.hidden { &.hidden {
opacity: 0; opacity: 0;
} }
&.animating { &.animating {
stroke: $color-primary; stroke: $color-primary;
stroke-dasharray: var(--len); stroke-dasharray: var(--len);
@@ -136,18 +94,18 @@
stroke-linecap: round; stroke-linecap: round;
stroke-linejoin: round; stroke-linejoin: round;
opacity: 0.5; opacity: 0.5;
stroke-dasharray: 10 15; stroke-dasharray: 0.625rem 0.9375rem;
} }
.stroke-badge-group { .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; pointer-events: none;
} }
.stroke-badge-bg { .stroke-badge-bg {
fill: $color-primary; fill: $color-primary;
opacity: 0.9; opacity: 0.9;
transition: transform 0.2s ease; transition: transform $duration-fast ease;
} }
.stroke-badge-text { .stroke-badge-text {
@@ -168,34 +126,31 @@
stroke-linecap: round; stroke-linecap: round;
stroke-linejoin: round; stroke-linejoin: round;
pointer-events: none; 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 { .play-btn {
position: absolute; position: absolute;
top: 10px; top: $size-play-btn-offset;
right: 10px; right: $size-play-btn-offset;
width: $size-icon-btn; width: $size-icon-btn;
height: $size-icon-btn; height: $size-icon-btn;
border-radius: $radius-circle; border-radius: $radius-circle;
background: rgb(255 255 255 / 10%); background: $bg-glass-strong;
border: 1px solid rgba($color-primary, 0.3); border: 1px solid color.change($color-primary, $alpha: 0.3);
color: $color-primary; color: $color-primary;
@include flex-center; @include flex-center;
cursor: pointer; cursor: pointer;
z-index: $z-play-btn; z-index: $z-play-btn;
transition: all 0.2s ease; transition: all $duration-fast ease;
&:hover { &:hover {
transform: scale(1.05); transform: scale(1.05);
background: rgba($color-primary, 0.2); background: color.change($color-primary, $alpha: 0.2);
} }
svg { svg {
width: 18px; width: $size-icon-small;
height: 18px; height: $size-icon-small;
} }
} }
@@ -204,31 +159,3 @@
stroke-dashoffset: 0; 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;
}

View 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;
}
}

View File

@@ -0,0 +1 @@
@use 'app-shell';

View File

@@ -1,11 +1,7 @@
@use 'abstracts/variables'; @charset 'utf-8';
@use 'abstracts/mixins';
@use 'base/typography'; @use 'abstracts';
@use 'components/buttons'; @use 'base';
@use 'components/widgets'; @use 'layout';
@use 'components/kanji'; @use 'components';
@use 'pages/app'; @use 'pages';
@use 'pages/dashboard';
@use 'pages/review';
@use 'pages/collection';
@use 'pages/lesson';

View File

@@ -1,5 +1,4 @@
@use '../abstracts/variables' as *; @use '../abstracts' as *;
@use '../abstracts/mixins' as *;
.sticky-search { .sticky-search {
position: sticky; position: sticky;
@@ -22,11 +21,10 @@
.kanji-card { .kanji-card {
@include card-base; @include card-base;
@include hover-lift; @include hover-lift;
aspect-ratio: 1; aspect-ratio: 1;
display: flex;
@include flex-column; flex-direction: column;
gap: 0;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
position: relative; position: relative;
@@ -36,17 +34,17 @@
font-size: $font-2xl; font-size: $font-2xl;
font-weight: $weight-medium; font-weight: $weight-medium;
line-height: $leading-tight; line-height: $leading-tight;
transition: all 0.3s ease; transition: all $duration-normal ease;
} }
&.zen-master { &.zen-master {
border: 1px solid rgb(255 215 0 / 50%); border: $border-width-sm solid $color-gold-glow;
background: linear-gradient(135deg, rgb(30 30 36 / 100%) 0%, rgb(45 45 55 / 100%) 100%); background: linear-gradient(135deg, $color-surface 0%, $color-surface-lighter 100%);
box-shadow: 0 0 15px rgb(255 215 0 / 15%); box-shadow: 0 0 0.9375rem $color-gold-glow;
animation: zen-pulse 4s infinite ease-in-out; animation: zen-pulse 4s infinite ease-in-out;
.k-char { .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); transform: scale(1.1);
} }
} }
@@ -66,19 +64,19 @@
.k-bars { .k-bars {
display: flex; display: flex;
gap: 3px; gap: 0.1875rem;
width: 60%; width: 60%;
height: 4px; height: 0.25rem;
margin-top: $spacing-sm; margin-top: $spacing-sm;
.bar { .bar {
flex: 1; flex: 1;
background: rgb(255 255 255 / 10%); background: $color-overlay-white;
border-radius: 2px; border-radius: $radius-xs;
transition: background-color 0.3s ease; transition: background-color $duration-normal ease;
&.filled { &.filled {
box-shadow: 0 0 4px rgb(0 0 0 / 30%); box-shadow: $shadow-srs-fill;
} }
} }
} }
@@ -86,18 +84,16 @@
@keyframes zen-pulse { @keyframes zen-pulse {
0% { 0% {
box-shadow: 0 0 10px rgb(255 215 0 / 10%); box-shadow: 0 0 0.625rem $color-gold-border;
border-color: rgb(255 215 0 / 30%); border-color: $color-gold-border;
} }
50% { 50% {
box-shadow: 0 0 20px rgb(255 215 0 / 30%); box-shadow: 0 0 1.25rem $color-gold-border;
border-color: rgb(255 215 0 / 80%); border-color: $color-gold-glow;
} }
100% { 100% {
box-shadow: 0 0 10px rgb(255 215 0 / 10%); box-shadow: 0 0 0.625rem $color-gold-border;
border-color: rgb(255 215 0 / 30%); border-color: $color-gold-border;
} }
} }

View File

@@ -1,5 +1,15 @@
@use '../abstracts/variables' as *; @use '../abstracts' as *;
@use '../abstracts/mixins' as *;
@keyframes dashboard-pop-in {
0% {
opacity: 0;
transform: translateY(20px) scale(0.95);
}
100% {
opacity: 1;
transform: translateY(0) scale(1);
}
}
.dashboard-layout { .dashboard-layout {
display: grid; display: grid;
@@ -11,24 +21,61 @@
margin: 0 auto; margin: 0 auto;
padding: $padding-page-y $padding-page-x; padding: $padding-page-y $padding-page-x;
box-sizing: border-box; box-sizing: border-box;
min-height: 50vh;
&.fade-in { // Center the loader when state is loading
@include animate-fade-up($duration-slow); &.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-area-full {
grid-column: 1 / -1; 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 { .stats-split-layout {
grid-column: 1 / -1; grid-column: 1 / -1;
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: $spacing-lg; gap: $spacing-lg;
@include grid-responsive($breakpoint-md); .stats-left {
grid-column: 1 / 3;
display: flex;
flex-direction: column;
gap: $spacing-lg;
}
.stats-left,
.stats-right { .stats-right {
@include flex-column($spacing-lg); 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 {
grid-column: 1 / -1;
}
} }
} }
} }

View File

@@ -0,0 +1,4 @@
@use 'dashboard';
@use 'collection';
@use 'review';
@use 'lesson';

View File

@@ -1,8 +1,8 @@
@use '../abstracts/variables' as *; @use '../abstracts' as *;
@use '../abstracts/mixins' as *;
.page-container-center { .page-container-center {
height: 100%; min-height: 100%;
height: auto;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
@@ -11,17 +11,6 @@
overflow-y: auto; 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 { .hero-wrapper {
width: $size-hero-wrapper; width: $size-hero-wrapper;
height: $size-hero-wrapper; height: $size-hero-wrapper;
@@ -37,8 +26,8 @@
.radical-chip { .radical-chip {
border-radius: $radius-md; border-radius: $radius-md;
border: $border-subtle; border: $border-width-sm solid $color-border;
background-color: #27272a; background-color: $color-surface-lighter;
img { img {
filter: invert(1); filter: invert(1);
@@ -62,7 +51,7 @@
.label { .label {
font-size: $font-xs; font-size: $font-xs;
color: #666; color: #666;
letter-spacing: 1px; letter-spacing: 0.0625rem;
text-transform: uppercase; text-transform: uppercase;
margin-bottom: $spacing-xs; margin-bottom: $spacing-xs;
} }

View File

@@ -1,12 +1,4 @@
@use '../abstracts/variables' as *; @use '../abstracts' as *;
@use '../abstracts/mixins' as *;
.review-card {
border: $border-subtle;
background-color: $color-surface !important;
width: 100%;
max-width: 420px;
}
.text-shadow { .text-shadow {
text-shadow: $text-shadow; text-shadow: $text-shadow;
@@ -18,8 +10,8 @@
.next-fab { .next-fab {
position: absolute; position: absolute;
bottom: 20px; bottom: $offset-fab;
right: 20px; right: $offset-fab;
z-index: $z-sticky; z-index: $z-sticky;
} }
} }
@@ -28,7 +20,6 @@
.scale-leave-active { .scale-leave-active {
transition: all $duration-normal $ease-out-back; transition: all $duration-normal $ease-out-back;
} }
.scale-enter-from, .scale-enter-from,
.scale-leave-to { .scale-leave-to {
opacity: 0; opacity: 0;
@@ -39,25 +30,18 @@
.fade-slide-leave-active { .fade-slide-leave-active {
transition: all $duration-normal $ease-default; transition: all $duration-normal $ease-default;
} }
.fade-slide-enter-from { .fade-slide-enter-from {
opacity: 0; opacity: 0;
transform: translateY($dist-slide-sm); transform: translateY($dist-slide-sm);
} }
.fade-slide-leave-to { .fade-slide-leave-to {
opacity: 0; opacity: 0;
transform: translateY(-#{$dist-slide-sm}); transform: translateY(-#{$dist-slide-sm});
} }
.opacity-80 {
opacity: 0.8;
}
.progress-bar { .progress-bar {
opacity: 0.3; opacity: $opacity-inactive;
} }
.gap-2 { .gap-2 {
gap: $spacing-sm; gap: $spacing-sm;
} }

View File

@@ -38,6 +38,7 @@ export class KanjiController {
this.isAnimating = false; this.isAnimating = false;
this.ctx = { bg: null, hint: null, draw: null }; this.ctx = { bg: null, hint: null, draw: null };
this.hintAnimationFrame = null;
} }
static createPathElement(d) { 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) { async loadChar(char, autoHint = false) {
this.autoHint = autoHint;
this.paths = [];
this.reset(); this.reset();
const hex = char.charCodeAt(0).toString(16).padStart(5, '0'); const hex = char.charCodeAt(0).toString(16).padStart(5, '0');
@@ -139,6 +149,11 @@ export class KanjiController {
} }
reset() { reset() {
if (this.hintAnimationFrame) {
cancelAnimationFrame(this.hintAnimationFrame);
this.hintAnimationFrame = null;
}
this.currentStrokeIdx = 0; this.currentStrokeIdx = 0;
this.mistakes = 0; this.mistakes = 0;
this.isAnimating = false; this.isAnimating = false;
@@ -148,6 +163,10 @@ export class KanjiController {
this.clearCanvas(this.ctx.hint); this.clearCanvas(this.ctx.hint);
this.drawGrid(); this.drawGrid();
this.resetDrawStyle(); this.resetDrawStyle();
if (this.autoHint && this.paths.length > 0) {
this.showHint();
}
} }
startStroke(point) { startStroke(point) {
@@ -191,6 +210,11 @@ export class KanjiController {
} }
showHint() { showHint() {
if (this.hintAnimationFrame) {
cancelAnimationFrame(this.hintAnimationFrame);
this.hintAnimationFrame = null;
}
this.clearCanvas(this.ctx.hint); this.clearCanvas(this.ctx.hint);
if (this.currentStrokeIdx >= this.paths.length) return; if (this.currentStrokeIdx >= this.paths.length) return;
@@ -199,20 +223,49 @@ export class KanjiController {
const len = pathEl.getTotalLength(); const len = pathEl.getTotalLength();
const ctx = this.ctx.hint; const ctx = this.ctx.hint;
ctx.beginPath();
ctx.strokeStyle = KANJI_CONSTANTS.COLORS.HINT; ctx.strokeStyle = KANJI_CONSTANTS.COLORS.HINT;
ctx.setLineDash(KANJI_CONSTANTS.DASH_ARRAY_HINT); ctx.setLineDash(KANJI_CONSTANTS.DASH_ARRAY_HINT);
const step = 5; const startTime = performance.now();
const count = Math.floor(len / step) + 1; const DURATION = 600;
Array.from({ length: count }).forEach((_, i) => { const animate = (now) => {
const dist = Math.min(i * step, len); const elapsed = now - startTime;
const pt = pathEl.getPointAtLength(dist); const progress = Math.min(elapsed / DURATION, 1);
if (i === 0) ctx.moveTo(pt.x * this.scale, pt.y * this.scale);
else ctx.lineTo(pt.x * this.scale, pt.y * this.scale); this.clearCanvas(ctx);
}); ctx.beginPath();
ctx.stroke();
const drawLen = len * progress;
const step = 5;
let first = true;
for (let dist = 0; dist <= drawLen; dist += step) {
const pt = pathEl.getPointAtLength(dist);
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) { redrawAllPerfectStrokes(includeCurrent = false) {
@@ -257,13 +310,22 @@ export class KanjiController {
})); }));
if (this.checkMatch(userNormalized, targetD)) { if (this.checkMatch(userNormalized, targetD)) {
if (this.hintAnimationFrame) {
cancelAnimationFrame(this.hintAnimationFrame);
this.hintAnimationFrame = null;
}
this.animateMorph(this.userPath, targetD, () => { this.animateMorph(this.userPath, targetD, () => {
this.currentStrokeIdx += 1; this.currentStrokeIdx += 1;
this.mistakes = 0; this.mistakes = 0;
this.redrawAllPerfectStrokes(); this.redrawAllPerfectStrokes();
this.clearCanvas(this.ctx.hint);
if (this.currentStrokeIdx >= this.paths.length) { if (this.currentStrokeIdx >= this.paths.length) {
this.onComplete(); this.onComplete();
} else if (this.autoHint) {
this.showHint();
} }
}); });
} else { } else {

View File

@@ -37,6 +37,13 @@
:class="{ 'zen-master': item.srsLevel >= 10 }" :class="{ 'zen-master': item.srsLevel >= 10 }"
@click="openDetail(item)" @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) }") .k-char(:style="{ color: item.srsLevel >= 10 ? '#ffd700' : getSRSColor(item.srsLevel) }")
| {{ item.char }} | {{ item.char }}
@@ -82,6 +89,7 @@
KanjiSvgViewer.mb-4( KanjiSvgViewer.mb-4(
v-if="showModal && selectedItem" v-if="showModal && selectedItem"
:char="selectedItem.char" :char="selectedItem.char"
:svg-content="preloadedSvg"
) )
.readings-container.mb-4 .readings-container.mb-4
@@ -131,6 +139,8 @@ const loading = ref(true);
const showModal = ref(false); const showModal = ref(false);
const selectedItem = ref(null); const selectedItem = ref(null);
const searchQuery = ref(''); const searchQuery = ref('');
const preparingId = ref(null);
const preloadedSvg = ref('');
onMounted(async () => { onMounted(async () => {
await store.fetchCollection(); await store.fetchCollection();
@@ -175,9 +185,27 @@ const SRS_COLORS = {
const getSRSColor = (lvl) => SRS_COLORS[lvl] || '#444'; const getSRSColor = (lvl) => SRS_COLORS[lvl] || '#444';
const openDetail = (item) => { const openDetail = async (item) => {
selectedItem.value = item; if (preparingId.value) return;
showModal.value = true; // 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 = () => { const redoLesson = () => {
@@ -206,5 +234,3 @@ const getNextReviewText = (dateStr, srsLvl) => {
return `Next: ${diffDays}d`; return `Next: ${diffDays}d`;
}; };
</script> </script>
<style lang="scss" src="@/styles/pages/_collection.scss" scoped></style>

View File

@@ -1,39 +1,54 @@
<template lang="pug"> <template lang="pug">
.dashboard-layout.fade-in .dashboard-layout(
WidgetWelcome( :class="{ 'is-loading': loading, 'is-ready': !loading }"
:queue-length="stats.queueLength" )
:lesson-count="stats.lessonCount" .d-flex.justify-center.align-center.fill-height.grid-area-full(
:has-lower-levels="stats.hasLowerLevels" v-if="loading"
:lower-level-count="stats.lowerLevelCount" style="min-height: 60vh;"
:forecast="stats.forecast"
@start="handleStart"
) )
.grid-area-full(v-if="!loading")
WidgetHeatmap(:heatmap-data="stats.heatmap")
.stats-split-layout(v-if="!loading")
.stats-left.d-flex.flex-column.gap-4
WidgetGhosts(:ghosts="stats.ghosts")
WidgetDistribution(:distribution="stats.distribution")
WidgetGuruMastery(:distribution="stats.distribution")
.stats-right
WidgetAccuracy(:accuracy="stats.accuracy")
WidgetStreak(:streak="stats.streak")
WidgetForecast(:forecast="stats.forecast")
.grid-area-full.d-flex.justify-center.mt-12(v-if="loading")
v-progress-circular( v-progress-circular(
indeterminate indeterminate
color="#00cec9" color="primary"
size="64" 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"
:has-lower-levels="stats.hasLowerLevels"
:lower-level-count="stats.lowerLevelCount"
:forecast="stats.forecast"
@start="handleStart"
)
.grid-area-full.slide-up-item(style="--delay: 100ms")
WidgetHeatmap(:heatmap-data="stats.heatmap")
.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")
</template> </template>
<script setup> <script setup>
/* eslint-disable no-unused-vars */ /* eslint-disable no-unused-vars */
import { ref, onMounted } from 'vue'; import { ref, onMounted, computed } from 'vue';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { useAppStore } from '@/stores/appStore'; import { useAppStore } from '@/stores/appStore';
@@ -50,25 +65,16 @@ const store = useAppStore();
const router = useRouter(); const router = useRouter();
const loading = ref(true); const loading = ref(true);
const stats = ref({ const stats = computed(() => store.stats || {});
queueLength: 0,
lessonCount: 0,
hasLowerLevels: false,
lowerLevelCount: 0,
distribution: {},
forecast: [],
ghosts: [],
accuracy: { total: 0, correct: 0 },
heatmap: {},
streak: { current: 0, history: [], shield: { ready: false } },
});
onMounted(async () => { onMounted(async () => {
loading.value = true;
try { try {
const data = await store.fetchStats(); await Promise.all([
if (data) { store.fetchStats(),
stats.value = { ...stats.value, ...data }; new Promise((resolve) => { setTimeout(resolve, 800); }),
} ]);
} catch (e) { } catch (e) {
console.error('Dashboard Load Error:', e); console.error('Dashboard Load Error:', e);
} finally { } finally {
@@ -80,5 +86,3 @@ function handleStart(mode) {
router.push({ path: '/review', query: { mode } }); router.push({ path: '/review', query: { mode } });
} }
</script> </script>
<style lang="scss" src="@/styles/pages/_dashboard.scss" scoped></style>

View File

@@ -1,9 +1,11 @@
<template lang="pug"> <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-card.lesson-card(
v-if="currentItem" v-else-if="currentItem"
elevation="0"
) )
.d-flex.align-center.pa-4.border-b-subtle .d-flex.align-center.pa-4.border-b-subtle
v-btn(icon="mdi-close" variant="text" to="/dashboard" color="grey") v-btn(icon="mdi-close" variant="text" to="/dashboard" color="grey")
@@ -82,7 +84,7 @@
) {{ $t('lesson.ready') }} ) {{ $t('lesson.ready') }}
.d-flex.justify-center.gap-4.mt-2(v-if="phase === 'drawing' && subPhase === 'practice'") .d-flex.justify-center.gap-4.mt-2(v-if="phase === 'drawing' && subPhase === 'practice'")
v-btn( v-btn(
variant="text" color="amber" @click="canvas?.showHint()" variant="text" color="amber" @click="useHint"
) {{ $t('lesson.hintAction') }} ) {{ $t('lesson.hintAction') }}
v-btn(variant="text" color="grey" @click="phase='demo'") {{ $t('lesson.watchAgain') }} 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 sessionDone = ref(0);
const sessionTotal = ref(0); const sessionTotal = ref(0);
const canvasOpacity = ref(1); const canvasOpacity = ref(1);
const loading = ref(true);
const canvas = ref(null); const canvas = ref(null);
const demoViewer = ref(null); const demoViewer = ref(null);
@@ -163,6 +166,7 @@ async function handleDrawComplete() {
await new Promise((r) => { setTimeout(r, 300); }); await new Promise((r) => { setTimeout(r, 300); });
subPhase.value = 'practice'; subPhase.value = 'practice';
await nextTick();
canvas.value?.reset(); canvas.value?.reset();
canvasOpacity.value = 1; canvasOpacity.value = 1;
@@ -186,9 +190,25 @@ async function handleDrawComplete() {
function handleMistake() { function handleMistake() {
if (subPhase.value === 'practice') practiceCount.value = 0; if (subPhase.value === 'practice') practiceCount.value = 0;
} }
function useHint() {
canvas.value?.showHint();
if (subPhase.value === 'practice') {
practiceCount.value = 0;
}
}
onMounted(async () => { onMounted(async () => {
loading.value = true;
await store.fetchLessonQueue(); await store.fetchLessonQueue();
sessionTotal.value = store.lessonQueue.length; sessionTotal.value = store.lessonQueue.length;
loadNext(); loadNext();
loading.value = false;
}); });
</script> </script>
<style lang="scss" scoped>
.page-container-center {
min-height: 100%;
}
</style>

View File

@@ -1,8 +1,12 @@
<template lang="pug"> <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-fade-transition(mode="out-in")
v-card.pa-6.rounded-xl.elevation-10.d-flex.flex-column.align-center.review-card( .d-flex.flex-column.justify-center.align-center.fill-height(v-if="loading")
v-if="currentItem" 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 .d-flex.align-center.w-100.mb-6
v-btn.mr-2( v-btn.mr-2(
@@ -51,19 +55,10 @@
color="amber-lighten-1" color="amber-lighten-1"
prepend-icon="mdi-lightbulb-outline" prepend-icon="mdi-lightbulb-outline"
size="small" size="small"
:disabled="showNext || statusCode === 'hint'" :disabled="showNext"
@click="triggerHint" @click="triggerHint"
) {{ $t('review.showHint') }} ) {{ $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( v-sheet.d-flex.align-center.justify-center(
width="100%" width="100%"
height="48" height="48"
@@ -137,6 +132,7 @@ const statusCode = ref('draw');
const showNext = ref(false); const showNext = ref(false);
const isFailure = ref(false); const isFailure = ref(false);
const kanjiCanvasRef = ref(null); const kanjiCanvasRef = ref(null);
const loading = ref(true);
const sessionTotal = ref(0); const sessionTotal = ref(0);
const sessionDone = ref(0); const sessionDone = ref(0);
@@ -166,6 +162,7 @@ function loadNext() {
} }
onMounted(async () => { onMounted(async () => {
loading.value = true;
const mode = route.query.mode || 'shuffled'; const mode = route.query.mode || 'shuffled';
await store.fetchQueue(mode); await store.fetchQueue(mode);
@@ -173,9 +170,11 @@ onMounted(async () => {
sessionTotal.value = store.queue.length; sessionTotal.value = store.queue.length;
} }
loadNext(); loadNext();
loading.value = false;
}); });
async function resetSession() { async function resetSession() {
loading.value = true;
sessionDone.value = 0; sessionDone.value = 0;
sessionCorrect.value = 0; sessionCorrect.value = 0;
sessionTotal.value = 0; sessionTotal.value = 0;
@@ -184,6 +183,7 @@ async function resetSession() {
await store.fetchQueue(mode); await store.fetchQueue(mode);
if (store.queue.length > 0) sessionTotal.value = store.queue.length; if (store.queue.length > 0) sessionTotal.value = store.queue.length;
loadNext(); loadNext();
loading.value = false;
} }
watch(() => store.batchSize, async () => { watch(() => store.batchSize, async () => {
@@ -253,3 +253,9 @@ const getStatusClass = (status) => {
} }
}; };
</script> </script>
<style lang="scss" scoped>
.review-view-container {
min-height: 100%;
}
</style>

View File

@@ -1,21 +1,18 @@
import { fileURLToPath, URL } from 'node:url'; import { fileURLToPath, URL } from 'node:url';
import { defineConfig } from 'vite'; import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue'; import vue from '@vitejs/plugin-vue';
import vueDevTools from 'vite-plugin-vue-devtools';
export default defineConfig({ export default defineConfig({
plugins: [vue()], plugins: [
vue(),
vueDevTools(),
],
resolve: { resolve: {
alias: { alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)), '@': fileURLToPath(new URL('./src', import.meta.url)),
}, },
}, },
css: {
preprocessorOptions: {
scss: {
additionalData: '@use "@/styles/abstracts/_variables.scss" as *; @use "@/styles/abstracts/_mixins.scss" as *;',
},
},
},
server: { server: {
allowedHosts: [ allowedHosts: [
'zenkanji.crylia.de', 'zenkanji.crylia.de',

View File

@@ -1,4 +1,4 @@
export const PORT = process.env.PORT || 3000; 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 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; export const JWT_SECRET = process.env.JWT_SECRET;

View File

@@ -97,7 +97,11 @@ export const processLesson = async (user, subjectId) => {
if (!item) throw new Error('Item not found'); if (!item) throw new Error('Item not found');
item.srsLevel = 1; 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(); await item.save();
return { success: true, item }; return { success: true, item };

View File

@@ -7,7 +7,6 @@ export const syncWithWaniKani = async (user) => {
console.log(`Starting sync for user: ${user._id}`); console.log(`Starting sync for user: ${user._id}`);
// 1. Fetch all assigned Kanji Subject IDs
let allSubjectIds = []; let allSubjectIds = [];
let nextUrl = 'https://api.wanikani.com/v2/assignments?subject_types=kanji&started=true'; 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." }; 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 existingItems = await StudyItem.find({ userId: user._id }).select('wkSubjectId');
const existingIds = new Set(existingItems.map(i => i.wkSubjectId)); const existingIds = new Set(existingItems.map(i => i.wkSubjectId));
const newIds = allSubjectIds.filter(id => !existingIds.has(id)); const newIds = allSubjectIds.filter(id => !existingIds.has(id));
console.log(`Found ${newIds.length} new items.`); console.log(`Found ${newIds.length} new items.`);
// 3. Process in chunks const CHUNK_SIZE = 50;
const CHUNK_SIZE = 50; // Reduced chunk size to accommodate secondary radical fetches
for (let i = 0; i < newIds.length; i += CHUNK_SIZE) { for (let i = 0; i < newIds.length; i += CHUNK_SIZE) {
const chunk = newIds.slice(i, 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(',')}`, { const subRes = await fetch(`https://api.wanikani.com/v2/subjects?ids=${chunk.join(',')}`, {
headers: { Authorization: `Bearer ${apiKey}` } headers: { Authorization: `Bearer ${apiKey}` }
}); });
const subJson = await subRes.json(); const subJson = await subRes.json();
const kanjiDataList = subJson.data; const kanjiDataList = subJson.data;
// B. Identify all needed Radicals
const radicalIdsToFetch = new Set(); const radicalIdsToFetch = new Set();
kanjiDataList.forEach(k => { kanjiDataList.forEach(k => {
if (k.data.component_subject_ids) { 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(); const radicalMap = new Map();
if (radicalIdsToFetch.size > 0) { if (radicalIdsToFetch.size > 0) {
const rIds = Array.from(radicalIdsToFetch); 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) { for (let j = 0; j < rIds.length; j += 100) {
const rChunk = rIds.slice(j, j + 100); const rChunk = rIds.slice(j, j + 100);
const rRes = await fetch(`https://api.wanikani.com/v2/subjects?ids=${rChunk.join(',')}`, { 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 => { rJson.data.forEach(r => {
const primaryMeaning = r.data.meanings.find(m => m.primary)?.meaning || 'Unknown'; const primaryMeaning = r.data.meanings.find(m => m.primary)?.meaning || 'Unknown';
const char = r.data.characters; const char = r.data.characters;
// Find SVG image if no character exists
const image = !char && r.data.character_images const image = !char && r.data.character_images
? r.data.character_images.find(img => img.content_type === 'image/svg+xml' && !img.metadata.inline_styles)?.url ? r.data.character_images.find(img => img.content_type === 'image/svg+xml' && !img.metadata.inline_styles)?.url
: null; : null;
@@ -82,14 +74,12 @@ export const syncWithWaniKani = async (user) => {
} }
} }
// D. Build Database Objects
const operations = kanjiDataList.map(d => { const operations = kanjiDataList.map(d => {
const readings = d.data.readings || []; const readings = d.data.readings || [];
// Map the IDs to our fetched radical data
const itemRadicals = (d.data.component_subject_ids || []) const itemRadicals = (d.data.component_subject_ids || [])
.map(rid => radicalMap.get(rid)) .map(rid => radicalMap.get(rid))
.filter(Boolean); // Remove any not found .filter(Boolean);
return { return {
userId: user._id, userId: user._id,
@@ -97,12 +87,12 @@ export const syncWithWaniKani = async (user) => {
char: d.data.characters, char: d.data.characters,
meaning: d.data.meanings.find(m => m.primary)?.meaning || 'Unknown', meaning: d.data.meanings.find(m => m.primary)?.meaning || 'Unknown',
level: d.data.level, level: d.data.level,
srsLevel: 1, srsLevel: 0,
nextReview: Date.now(), nextReview: Date.now(),
onyomi: readings.filter(r => r.type === 'onyomi').map(r => r.reading), onyomi: readings.filter(r => r.type === 'onyomi').map(r => r.reading),
kunyomi: readings.filter(r => r.type === 'kunyomi').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), nanori: readings.filter(r => r.type === 'nanori').map(r => r.reading),
radicals: itemRadicals, // Save them radicals: itemRadicals,
stats: { correct: 0, total: 0 } stats: { correct: 0, total: 0 }
}; };
}); });

View File

@@ -28,5 +28,6 @@ export const getSRSDate = (level) => {
if (hoursToAdd === 0) return null; if (hoursToAdd === 0) return null;
now.setUTCHours(now.getUTCHours() + hoursToAdd); now.setUTCHours(now.getUTCHours() + hoursToAdd);
now.setUTCMinutes(0, 0, 0);
return now; return now;
}; };