From 4be0370839ca7f1ebba2294dca4727c585e5d22d Mon Sep 17 00:00:00 2001 From: "Felix T.J. Dietrich" Date: Sun, 15 Sep 2024 17:15:18 +0200 Subject: [PATCH] restructure project --- webapp/src/app/app.component.ts | 2 +- webapp/src/app/app.routes.ts | 4 ++-- .../theme}/theme-switcher.component.html | 0 .../theme}/theme-switcher.component.ts | 0 .../theme}/theme-switcher.service.ts | 0 .../theme}/theme-switcher.stories.ts | 2 +- .../home.component.html} | 0 webapp/src/app/home/home.component.ts | 10 ++++++++++ webapp/src/app/home/home.stories.ts | 18 ++++++++++++++++++ .../leaderboard/leaderboard.component.html | 0 .../leaderboard/leaderboard.component.ts | 0 .../leaderboard/leaderboard.stories.ts | 2 +- webapp/src/app/main/main.component.ts | 10 ---------- 13 files changed, 33 insertions(+), 15 deletions(-) rename webapp/src/app/{components/theme-switcher => core/theme}/theme-switcher.component.html (100%) rename webapp/src/app/{components/theme-switcher => core/theme}/theme-switcher.component.ts (100%) rename webapp/src/app/{components/theme-switcher => core/theme}/theme-switcher.service.ts (100%) rename webapp/src/app/{components/theme-switcher => core/theme}/theme-switcher.stories.ts (94%) rename webapp/src/app/{main/main.component.html => home/home.component.html} (100%) create mode 100644 webapp/src/app/home/home.component.ts create mode 100644 webapp/src/app/home/home.stories.ts rename webapp/src/app/{components => home}/leaderboard/leaderboard.component.html (100%) rename webapp/src/app/{components => home}/leaderboard/leaderboard.component.ts (100%) rename webapp/src/app/{components => home}/leaderboard/leaderboard.stories.ts (91%) delete mode 100644 webapp/src/app/main/main.component.ts diff --git a/webapp/src/app/app.component.ts b/webapp/src/app/app.component.ts index 41c404cf..eb7377c8 100644 --- a/webapp/src/app/app.component.ts +++ b/webapp/src/app/app.component.ts @@ -2,7 +2,7 @@ import { Component, isDevMode } from '@angular/core'; import { AngularQueryDevtools } from '@tanstack/angular-query-devtools-experimental'; import { RouterLink, RouterLinkActive, RouterOutlet } from '@angular/router'; import { LucideAngularModule, Hammer } from 'lucide-angular'; -import { ThemeSwitcherComponent } from './components/theme-switcher/theme-switcher.component'; +import { ThemeSwitcherComponent } from 'app/core/theme/theme-switcher.component'; @Component({ selector: 'app-root', diff --git a/webapp/src/app/app.routes.ts b/webapp/src/app/app.routes.ts index 9060460d..4ddba63d 100644 --- a/webapp/src/app/app.routes.ts +++ b/webapp/src/app/app.routes.ts @@ -1,8 +1,8 @@ import { Routes } from '@angular/router'; import { AboutComponent } from 'app/about/about.component'; -import { MainComponent } from 'app/main/main.component'; +import { HomeComponent } from 'app/home/home.component'; export const routes: Routes = [ - { path: '', component: MainComponent }, + { path: '', component: HomeComponent }, { path: 'about', component: AboutComponent } ]; diff --git a/webapp/src/app/components/theme-switcher/theme-switcher.component.html b/webapp/src/app/core/theme/theme-switcher.component.html similarity index 100% rename from webapp/src/app/components/theme-switcher/theme-switcher.component.html rename to webapp/src/app/core/theme/theme-switcher.component.html diff --git a/webapp/src/app/components/theme-switcher/theme-switcher.component.ts b/webapp/src/app/core/theme/theme-switcher.component.ts similarity index 100% rename from webapp/src/app/components/theme-switcher/theme-switcher.component.ts rename to webapp/src/app/core/theme/theme-switcher.component.ts diff --git a/webapp/src/app/components/theme-switcher/theme-switcher.service.ts b/webapp/src/app/core/theme/theme-switcher.service.ts similarity index 100% rename from webapp/src/app/components/theme-switcher/theme-switcher.service.ts rename to webapp/src/app/core/theme/theme-switcher.service.ts diff --git a/webapp/src/app/components/theme-switcher/theme-switcher.stories.ts b/webapp/src/app/core/theme/theme-switcher.stories.ts similarity index 94% rename from webapp/src/app/components/theme-switcher/theme-switcher.stories.ts rename to webapp/src/app/core/theme/theme-switcher.stories.ts index 3f00cdb2..a524cd0c 100644 --- a/webapp/src/app/components/theme-switcher/theme-switcher.stories.ts +++ b/webapp/src/app/core/theme/theme-switcher.stories.ts @@ -4,7 +4,7 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; // More on how to set up stories at: https://storybook.js.org/docs/writing-stories const meta: Meta = { - title: 'Components/ThemeSwitcher', + title: 'Components/Core/ThemeSwitcher', component: ThemeSwitcherComponent, tags: ['autodocs'], decorators: [ diff --git a/webapp/src/app/main/main.component.html b/webapp/src/app/home/home.component.html similarity index 100% rename from webapp/src/app/main/main.component.html rename to webapp/src/app/home/home.component.html diff --git a/webapp/src/app/home/home.component.ts b/webapp/src/app/home/home.component.ts new file mode 100644 index 00000000..1ed09c17 --- /dev/null +++ b/webapp/src/app/home/home.component.ts @@ -0,0 +1,10 @@ +import { Component } from '@angular/core'; +import { LeaderboardComponent } from 'app/home/leaderboard/leaderboard.component'; + +@Component({ + selector: 'app-home', + standalone: true, + imports: [LeaderboardComponent], + templateUrl: './home.component.html' +}) +export class HomeComponent {} diff --git a/webapp/src/app/home/home.stories.ts b/webapp/src/app/home/home.stories.ts new file mode 100644 index 00000000..d57e1d07 --- /dev/null +++ b/webapp/src/app/home/home.stories.ts @@ -0,0 +1,18 @@ +import { type Meta, type StoryObj } from '@storybook/angular'; +import { HomeComponent } from './home.component'; + +const meta: Meta = { + title: 'Pages/Home', + component: HomeComponent, + tags: ['autodocs'] +}; + +export default meta; +type Story = StoryObj; + +export const Default: Story = { + render: (args) => ({ + props: args, + template: `` + }) +}; diff --git a/webapp/src/app/components/leaderboard/leaderboard.component.html b/webapp/src/app/home/leaderboard/leaderboard.component.html similarity index 100% rename from webapp/src/app/components/leaderboard/leaderboard.component.html rename to webapp/src/app/home/leaderboard/leaderboard.component.html diff --git a/webapp/src/app/components/leaderboard/leaderboard.component.ts b/webapp/src/app/home/leaderboard/leaderboard.component.ts similarity index 100% rename from webapp/src/app/components/leaderboard/leaderboard.component.ts rename to webapp/src/app/home/leaderboard/leaderboard.component.ts diff --git a/webapp/src/app/components/leaderboard/leaderboard.stories.ts b/webapp/src/app/home/leaderboard/leaderboard.stories.ts similarity index 91% rename from webapp/src/app/components/leaderboard/leaderboard.stories.ts rename to webapp/src/app/home/leaderboard/leaderboard.stories.ts index 421fb862..d7388257 100644 --- a/webapp/src/app/components/leaderboard/leaderboard.stories.ts +++ b/webapp/src/app/home/leaderboard/leaderboard.stories.ts @@ -2,7 +2,7 @@ import { type Meta, type StoryObj } from '@storybook/angular'; import { LeaderboardComponent } from './leaderboard.component'; const meta: Meta = { - title: 'Components/Leaderboard', + title: 'Components/Home/Leaderboard', component: LeaderboardComponent, tags: ['autodocs'] }; diff --git a/webapp/src/app/main/main.component.ts b/webapp/src/app/main/main.component.ts deleted file mode 100644 index b7da7157..00000000 --- a/webapp/src/app/main/main.component.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Component } from '@angular/core'; -import { LeaderboardComponent } from 'app/components/leaderboard/leaderboard.component'; - -@Component({ - selector: 'app-main', - standalone: true, - imports: [LeaderboardComponent], - templateUrl: './main.component.html' -}) -export class MainComponent {}