Skip to content

Commit 23c4428

Browse files
wip
1 parent b94f7e4 commit 23c4428

File tree

8 files changed

+28
-30
lines changed

8 files changed

+28
-30
lines changed

angular.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@
2121
"index": "src/index.html",
2222
"browser": "src/main.ts",
2323
"allowedCommonJsDependencies": [
24-
"highlight.js"
24+
"highlight.js",
25+
"quill-delta",
26+
"whatwg-url",
27+
"@supabase/node-fetch"
2528
],
2629
"polyfills": [
2730
"zone.js"
@@ -40,11 +43,10 @@
4043
"scripts": [],
4144
"server": "src/main.server.ts",
4245
"prerender": {
46+
"discoverRoutes": false,
4347
"routesFile": "routes.txt"
4448
},
45-
"ssr": {
46-
"entry": "server.ts"
47-
}
49+
"ssr": true
4850
},
4951
"configurations": {
5052
"production": {

routes.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/

src/app/app.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<div>
2-
<router-outlet/>
2+
<!-- <router-outlet/>-->
33
</div>

src/app/app.component.ts

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,14 @@ import { SupabaseService } from './services/supabase.service';
1717
templateUrl: './app.component.html',
1818
styleUrl: './app.component.scss',
1919
})
20-
export class AppComponent implements OnInit {
21-
cookieConsentService = inject(CookieConsentService);
22-
viewContainerRef = inject(ViewContainerRef);
23-
24-
supabase = inject(SupabaseService);
20+
export class AppComponent {
21+
// cookieConsentService = inject(CookieConsentService);
22+
// viewContainerRef = inject(ViewContainerRef);
2523

2624
constructor() {
27-
afterNextRender(() =>
28-
this.cookieConsentService.showCookieConsent(this.viewContainerRef),
29-
);
30-
}
31-
32-
ngOnInit() {
33-
this.supabase.getClient
34-
.from('tags')
35-
.select('*')
36-
.then((tags) => {
37-
console.log(tags);
38-
});
25+
console.log('AppComponent');
26+
// afterNextRender(() =>
27+
// this.cookieConsentService.showCookieConsent(this.viewContainerRef),
28+
// );
3929
}
4030
}

src/app/app.routes.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Routes } from '@angular/router';
22
import { readerRoutes } from './reader/reader.routes';
3-
import { authGuard } from './auth/_guards/auth.guard';
3+
import { authAdminGuard } from './auth/_guards/authAdminGuard';
44

55
export const routes: Routes = [
66
{
@@ -9,12 +9,13 @@ export const routes: Routes = [
99
},
1010
{
1111
path: 'admin',
12-
loadChildren: () => import('./admin/admin.routes').then(r => r.adminRoutes),
12+
loadChildren: () =>
13+
import('./admin/admin.routes').then((r) => r.adminRoutes),
1314
title: 'Admin',
14-
canActivate: [authGuard],
15+
canActivate: [authAdminGuard],
1516
},
1617
{
17-
path:'**',
18-
redirectTo: ''
18+
path: '**',
19+
redirectTo: '',
1920
},
2021
];

src/app/auth/_guards/auth.guard.ts renamed to src/app/auth/_guards/authAdminGuard.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { AuthService } from '../auth.service';
1616
import { SupabaseService } from '../../services/supabase.service';
1717
>>>>>>> 793fe4a (login fixed)
1818

19-
export const authGuard: CanMatchFn = (): boolean => {
19+
export const authAdminGuard: CanMatchFn = (): boolean => {
2020
const supabaseService = inject(SupabaseService);
2121
const router = inject(Router);
2222
<<<<<<< HEAD
@@ -31,10 +31,14 @@ export const authGuard: CanMatchFn = (): boolean => {
3131
=======
3232
const session = supabaseService.getSession();
3333

34+
<<<<<<< HEAD:src/app/auth/_guards/auth.guard.ts
3435
// For now, just check if the user is authenticated
3536
// In a real application, you would check for specific roles in the user's metadata
3637
if (session) {
3738
>>>>>>> 793fe4a (login fixed)
39+
=======
40+
if (session?.user?.app_metadata?.['role'] === Roles.ADMIN) {
41+
>>>>>>> bc9c691 (wip):src/app/auth/_guards/authAdminGuard.ts
3842
return true;
3943
} else {
4044
router.navigate(['/posts']);

src/app/reader/_components/main-page/posts-list/posts-list.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export class PostsListComponent {
5252
this.onScroll.bind(this),
5353
);
5454
});
55+
console.log('init');
5556
}
5657

5758
onScroll(event: Event) {

src/styles.scss

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@use 'tailwindcss/utilities';
12
@import "../node_modules/quill/dist/quill.core.css";
23
@import "../node_modules/quill/dist/quill.snow.css";
34
@import 'highlight.js/styles/atom-one-dark.css';
@@ -80,8 +81,6 @@ h4 {
8081
@apply bg-gray-300 text-gray-500 cursor-not-allowed;
8182
}
8283

83-
/* Import TailwindCSS */
84-
@import 'tailwindcss/utilities';
8584

8685
/* Additional styles for the card component */
8786
.post-card {

0 commit comments

Comments
 (0)