feat: upgrade to SQLite session & data store with zero-data-loss migration, dark theme, and Turkish i18n
This commit is contained in:
parent
1af973d001
commit
56274f479b
27 changed files with 4222 additions and 1360 deletions
|
|
@ -7,6 +7,13 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||
const btnSyncSyllabus = document.getElementById('btnSyncSyllabus');
|
||||
const syllabusAlert = document.getElementById('syllabusAlert');
|
||||
|
||||
function t(key, params) {
|
||||
if (typeof window.BeKulturT === 'function') {
|
||||
return window.BeKulturT(key, params);
|
||||
}
|
||||
return key;
|
||||
}
|
||||
|
||||
// 1. Station Pill Selection (AJAX)
|
||||
if (stationPills) {
|
||||
stationPills.addEventListener('click', async (e) => {
|
||||
|
|
@ -14,7 +21,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||
if (!btn) return;
|
||||
|
||||
if (window.BeKulturPWA && window.BeKulturPWA.isOffline()) {
|
||||
showAlert('Çevrimdışı moddasınız. İstasyon seçimi için internet bağlantısı gereklidir.', 'danger');
|
||||
showAlert(t('syllabus.offlineStationAlert'), 'danger');
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -80,28 +87,28 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||
if (btnSyncSyllabus) {
|
||||
btnSyncSyllabus.addEventListener('click', async () => {
|
||||
if (window.BeKulturPWA && window.BeKulturPWA.isOffline()) {
|
||||
showAlert('Çevrimdışı moddasınız. Senkronizasyon için internet bağlantısı gereklidir.', 'danger');
|
||||
showAlert(t('dashboard.offlineSyncAlert'), 'danger');
|
||||
return;
|
||||
}
|
||||
btnSyncSyllabus.disabled = true;
|
||||
btnSyncSyllabus.textContent = 'Syncing...';
|
||||
showAlert('Fetching weekly timetable across all 5 days...', 'info');
|
||||
btnSyncSyllabus.textContent = t('syllabus.syncing');
|
||||
showAlert(t('syllabus.fetchingAlert'), 'info');
|
||||
|
||||
try {
|
||||
const res = await fetch('/api/syllabus/sync', { method: 'POST' });
|
||||
const data = await res.json();
|
||||
if (data.success) {
|
||||
showAlert('Syllabus updated successfully!', 'info');
|
||||
showAlert(t('syllabus.updatedAlert'), 'info');
|
||||
window.location.reload();
|
||||
} else {
|
||||
showAlert(`Sync failed: ${data.error}`, 'danger');
|
||||
showAlert(`${t('dashboard.syncFailed')} ${data.error}`, 'danger');
|
||||
btnSyncSyllabus.disabled = false;
|
||||
btnSyncSyllabus.textContent = 'Sync Syllabus';
|
||||
btnSyncSyllabus.textContent = t('syllabus.syncBtn');
|
||||
}
|
||||
} catch (err) {
|
||||
showAlert('Network error while syncing syllabus.', 'danger');
|
||||
showAlert(t('dashboard.networkError'), 'danger');
|
||||
btnSyncSyllabus.disabled = false;
|
||||
btnSyncSyllabus.textContent = 'Sync Syllabus';
|
||||
btnSyncSyllabus.textContent = t('syllabus.syncBtn');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue