🚀 مُصادَق: تحديث برمجي جديد 2026-05-03 01:19

This commit is contained in:
Hamza-Ayed
2026-05-03 01:19:24 +03:00
parent 6e241c6379
commit 3ced45c9cd
2 changed files with 43 additions and 4 deletions

View File

@@ -88,10 +88,11 @@
<script type="module">
import API from './assets/js/api.js';
window.appRouter = () => ({
isLoggedIn: !!localStorage.getItem('access_token'),
pageHtml: 'جاري التحميل...',
async init() {
document.addEventListener('alpine:init', () => {
Alpine.data('appRouter', () => ({
isLoggedIn: !!localStorage.getItem('access_token'),
pageHtml: 'جاري التحميل...',
async init() {
console.log('App Initialized');
await this.navigate(window.location.pathname);
window.onpopstate = () => this.navigate(window.location.pathname);
@@ -206,6 +207,7 @@
`;
return '<div>الصفحة قيد الإنشاء</div>';
}
}));
});
</script>
</body>

37
scratch.js Normal file
View File

@@ -0,0 +1,37 @@
const appRouter = () => ({
isLoggedIn: !!localStorage.getItem('access_token'),
pageHtml: 'جاري التحميل...',
async init() {
console.log('App Initialized');
await this.navigate(window.location.pathname);
window.onpopstate = () => this.navigate(window.location.pathname);
},
async navigate(path) {
console.log('Navigating to:', path);
const isLogin = path.includes('login');
if (!this.isLoggedIn && !isLogin) {
this.pageHtml = await this.loadPage('login');
} else if (isLogin) {
this.pageHtml = await this.loadPage('login');
} else {
this.pageHtml = await this.loadPage('dashboard');
}
},
initCharts() {
const ctx = document.getElementById('invoiceChart')?.getContext('2d');
},
async loadPage(page) {
if (page === 'dashboard') {
return `<div></div>`;
}
if (page === 'login') return `
<div class="flex flex-col items-center justify-center min-h-[60vh]">
<div class="w-full max-w-md p-8 glass rounded-3xl glow border-white/10">
<h2 class="text-3xl font-bold mb-2 text-center">مرحباً بك مجدداً</h2>
</div>
</div>
`;
return '<div>الصفحة قيد الإنشاء</div>';
}
});