1
Fork 0
mirror of https://github.com/wlinator/luminara.git synced 2024-10-02 18:23:12 +00:00

Add Angular project structure and dependencies

This commit is contained in:
wlinator 2024-09-23 16:53:03 +02:00
parent 2a177c2f75
commit a804b4118a
34 changed files with 15354 additions and 1 deletions

View file

@ -34,4 +34,4 @@ repos:
hooks:
- id: pyupgrade
exclude: ".archive/"
exclude: "dashboard/"

16
dashboard/.editorconfig Normal file
View file

@ -0,0 +1,16 @@
# Editor configuration, see https://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
[*.ts]
quote_type = single
[*.md]
max_line_length = off
trim_trailing_whitespace = false

42
dashboard/.gitignore vendored Normal file
View file

@ -0,0 +1,42 @@
# See https://docs.github.com/get-started/getting-started-with-git/ignoring-files for more about ignoring files.
# Compiled output
/dist
/tmp
/out-tsc
/bazel-out
# Node
/node_modules
npm-debug.log
yarn-error.log
# IDEs and editors
.idea/
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# Visual Studio Code
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*
# Miscellaneous
/.angular/cache
.sass-cache/
/connect.lock
/coverage
/libpeerconnection.log
testem.log
/typings
# System files
.DS_Store
Thumbs.db

27
dashboard/README.md Normal file
View file

@ -0,0 +1,27 @@
# Dashboard
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 18.1.0.
## Development server
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files.
## Code scaffolding
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
## Build
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.
## Running unit tests
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
## Running end-to-end tests
Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
## Further help
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.

96
dashboard/angular.json Normal file
View file

@ -0,0 +1,96 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"dashboard": {
"projectType": "application",
"schematics": {},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:application",
"options": {
"outputPath": "dist/dashboard",
"index": "src/index.html",
"browser": "src/main.ts",
"polyfills": [
"zone.js"
],
"tsConfig": "tsconfig.app.json",
"assets": [
{
"glob": "**/*",
"input": "public"
}
],
"styles": [
"src/styles.css"
],
"scripts": []
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "500kB",
"maximumError": "1MB"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kB",
"maximumError": "4kB"
}
],
"outputHashing": "all"
},
"development": {
"optimization": false,
"extractLicenses": false,
"sourceMap": true
}
},
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"configurations": {
"production": {
"buildTarget": "dashboard:build:production"
},
"development": {
"buildTarget": "dashboard:build:development"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n"
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"polyfills": [
"zone.js",
"zone.js/testing"
],
"tsConfig": "tsconfig.spec.json",
"assets": [
{
"glob": "**/*",
"input": "public"
}
],
"styles": [
"src/styles.css"
],
"scripts": []
}
}
}
}
}
}

14793
dashboard/package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

42
dashboard/package.json Normal file
View file

@ -0,0 +1,42 @@
{
"name": "dashboard",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test"
},
"private": true,
"dependencies": {
"@angular/animations": "^18.1.0",
"@angular/common": "^18.1.0",
"@angular/compiler": "^18.1.0",
"@angular/core": "^18.1.0",
"@angular/forms": "^18.1.0",
"@angular/platform-browser": "^18.1.0",
"@angular/platform-browser-dynamic": "^18.1.0",
"@angular/router": "^18.1.0",
"@fortawesome/angular-fontawesome": "^0.15.0",
"@fortawesome/free-brands-svg-icons": "^6.6.0",
"@fortawesome/free-solid-svg-icons": "^6.6.0",
"rxjs": "~7.8.0",
"tailwindcss": "^3.4.12",
"tslib": "^2.3.0",
"zone.js": "~0.14.3"
},
"devDependencies": {
"@angular-devkit/build-angular": "^18.1.0",
"@angular/cli": "^18.1.0",
"@angular/compiler-cli": "^18.1.0",
"@types/jasmine": "~5.1.0",
"jasmine-core": "~5.1.0",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.2.0",
"karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.1.0",
"typescript": "~5.5.2"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View file

View file

@ -0,0 +1 @@
<app-home></app-home>

View file

@ -0,0 +1,29 @@
import { TestBed } from '@angular/core/testing';
import { AppComponent } from './app.component';
describe('AppComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [AppComponent],
}).compileComponents();
});
it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app).toBeTruthy();
});
it(`should have the 'dashboard' title`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app.title).toEqual('dashboard');
});
it('should render title', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.nativeElement as HTMLElement;
expect(compiled.querySelector('h1')?.textContent).toContain('Hello, dashboard');
});
});

View file

@ -0,0 +1,14 @@
import { Component } from '@angular/core';
import { RouterOutlet } from '@angular/router';
import { HomeComponent } from './home/home.component';
@Component({
selector: 'app-root',
standalone: true,
imports: [RouterOutlet, HomeComponent],
templateUrl: './app.component.html',
styleUrl: './app.component.css'
})
export class AppComponent {
title = 'Luminara';
}

View file

@ -0,0 +1,8 @@
import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';
import { provideRouter } from '@angular/router';
import { routes } from './app.routes';
export const appConfig: ApplicationConfig = {
providers: [provideZoneChangeDetection({ eventCoalescing: true }), provideRouter(routes)]
};

View file

@ -0,0 +1,3 @@
import { Routes } from '@angular/router';
export const routes: Routes = [];

View file

@ -0,0 +1,10 @@
<div
class="w-120 h-64 mx-auto from-blue-50 via-gray-50 to-white p-6 rounded-lg hover:shadow-lg hover:scale-105 transition transform">
<div class="flex flex-col items-center">
<div class="w-24 h-24 from-gray-100 to-gray-300 rounded-full flex items-center justify-center mb-4">
<fa-icon [icon]="getIcon()" class="text-4xl text-blue-600"></fa-icon>
</div>
<h2 class="text-2xl font-semibold text-gray-700 mb-2">{{ title }}</h2>
<p class="text-gray-500 text-center">{{ description }}</p>
</div>
</div>

View file

@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { HomeWidgetComponent } from './home-widget.component';
describe('HomeWidgetComponent', () => {
let component: HomeWidgetComponent;
let fixture: ComponentFixture<HomeWidgetComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [HomeWidgetComponent]
})
.compileComponents();
fixture = TestBed.createComponent(HomeWidgetComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View file

@ -0,0 +1,43 @@
import { Component, Input } from '@angular/core';
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
import { faGavel, faSlidersH, faCode, faLevelUpAlt, faCoins, faSmile } from '@fortawesome/free-solid-svg-icons';
@Component({
selector: 'app-home-widget',
standalone: true,
imports: [FontAwesomeModule],
templateUrl: './home-widget.component.html',
styleUrl: './home-widget.component.css'
})
export class HomeWidgetComponent {
@Input() icon!: 'faGavel' | 'faSlidersH' | 'faCode' | 'faLevelUpAlt' | 'faCoins' | 'faSmile';
@Input() title!: string;
@Input() description!: string;
@Input() link!: string;
faGavel = faGavel;
faSlidersH = faSlidersH;
faCode = faCode;
faLevelUpAlt = faLevelUpAlt;
faCoins = faCoins;
faSmile = faSmile;
getIcon() {
switch (this.icon) {
case 'faGavel':
return this.faGavel;
case 'faSlidersH':
return this.faSlidersH;
case 'faCode':
return this.faCode;
case 'faLevelUpAlt':
return this.faLevelUpAlt;
case 'faCoins':
return this.faCoins;
case 'faSmile':
return this.faSmile;
default:
return this.faGavel; // fallback to default icon
}
}
}

View file

@ -0,0 +1,33 @@
<div class="min-h-screen bg-gradient-to-br from-gray-100 via-white to-gray-200 text-gray-800">
<div class="container mx-auto px-4 py-16">
<div class="text-center">
<div
class="w-32 h-32 mx-auto mb-8 bg-gradient-to-br from-orange-200 to-orange-400 rounded-full overflow-hidden shadow-lg flex items-center justify-center">
<img src="https://git.wlinator.org/Luminara/Art/raw/branch/main/lumi_logo.png" alt="Luminara Logo"
class="w-full h-full object-cover">
</div>
<h1 class="text-3xl md:text-5xl font-extrabold mb-4">{{ title }}</h1>
<p class="text-lg md:text-xl mb-6 text-gray-600">A general purpose Discord bot with a focus on robust moderation.
</p>
<!-- Button to login-->
<app-login-button></app-login-button>
</div>
<div class="mt-16 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
<!-- widgets here-->
<app-home-widget icon="faGavel" title="Moderation"
description="Robust moderation tools to keep your server safe."></app-home-widget>
<app-home-widget icon="faSlidersH" title="Customization"
description="Fine-tune your server settings with ease."></app-home-widget>
<app-home-widget icon="faCode" title="Open Source"
description="Luminara is an open source project, you can view the source code on GitHub."
link="https://github.com/wlinator/luminara"></app-home-widget>
<app-home-widget icon="faLevelUpAlt" title="Leveling System"
description="Engage your community with a fun and interactive leveling system."></app-home-widget>
<app-home-widget icon="faCoins" title="Economy"
description="Create an in-server economy with virtual currency and items."></app-home-widget>
<app-home-widget icon="faSmile" title="Custom Reactions"
description="Set up custom reactions to enhance user interaction."></app-home-widget>
</div>
</div>
</div>

View file

@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { HomeComponent } from './home.component';
describe('HomeComponent', () => {
let component: HomeComponent;
let fixture: ComponentFixture<HomeComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [HomeComponent]
})
.compileComponents();
fixture = TestBed.createComponent(HomeComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View file

@ -0,0 +1,14 @@
import { Component } from '@angular/core';
import { LoginButtonComponent } from '../login-button/login-button.component';
import { HomeWidgetComponent } from '../home-widget/home-widget.component';
@Component({
selector: 'app-home',
standalone: true,
imports: [LoginButtonComponent, HomeWidgetComponent],
templateUrl: './home.component.html',
styleUrl: './home.component.css'
})
export class HomeComponent {
title = 'Luminara';
}

View file

@ -0,0 +1,4 @@
<a href="#"
class="inline-block bg-indigo-500 text-white font-semibold px-8 py-3 rounded-full shadow-lg hover:bg-indigo-600 transition duration-200 flex items-center justify-center w-64 mx-auto">
<fa-icon [icon]="faDiscord" class="mr-2"></fa-icon> Log in with Discord
</a>

View file

@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { LoginButtonComponent } from './login-button.component';
describe('LoginButtonComponent', () => {
let component: LoginButtonComponent;
let fixture: ComponentFixture<LoginButtonComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [LoginButtonComponent]
})
.compileComponents();
fixture = TestBed.createComponent(LoginButtonComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View file

@ -0,0 +1,14 @@
import { Component } from '@angular/core';
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
import { faDiscord } from '@fortawesome/free-brands-svg-icons';
@Component({
selector: 'app-login-button',
standalone: true,
imports: [FontAwesomeModule],
templateUrl: './login-button.component.html',
styleUrl: './login-button.component.css'
})
export class LoginButtonComponent {
faDiscord = faDiscord;
}

13
dashboard/src/index.html Normal file
View file

@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Dashboard</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<app-root></app-root>
</body>
</html>

6
dashboard/src/main.ts Normal file
View file

@ -0,0 +1,6 @@
import { bootstrapApplication } from '@angular/platform-browser';
import { appConfig } from './app/app.config';
import { AppComponent } from './app/app.component';
bootstrapApplication(AppComponent, appConfig)
.catch((err) => console.error(err));

4
dashboard/src/styles.css Normal file
View file

@ -0,0 +1,4 @@
/* You can add global styles to this file, and also import other style files */
@tailwind base;
@tailwind components;
@tailwind utilities;

View file

@ -0,0 +1,8 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ['./src/**/*.{html,ts}'],
theme: {
extend: {},
},
plugins: [],
};

View file

@ -0,0 +1,15 @@
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"types": []
},
"files": [
"src/main.ts"
],
"include": [
"src/**/*.d.ts"
]
}

32
dashboard/tsconfig.json Normal file
View file

@ -0,0 +1,32 @@
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
{
"compileOnSave": false,
"compilerOptions": {
"outDir": "./dist/out-tsc",
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"skipLibCheck": true,
"esModuleInterop": true,
"sourceMap": true,
"declaration": false,
"experimentalDecorators": true,
"moduleResolution": "bundler",
"importHelpers": true,
"target": "ES2022",
"module": "ES2022",
"lib": [
"ES2022",
"dom"
]
},
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
"strictTemplates": true
}
}

View file

@ -0,0 +1,15 @@
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/spec",
"types": [
"jasmine"
]
},
"include": [
"src/**/*.spec.ts",
"src/**/*.d.ts"
]
}

View file

@ -64,6 +64,7 @@ exclude = [
"tests",
".archive",
"stubs",
"dashboard",
]
indent-width = 4
@ -144,6 +145,7 @@ exclude = [
"tests",
".archive",
"stubs",
"dashboard",
]
include = ["**/*.py"]
pythonPlatform = "Linux"