Standardize coding style and formatting across the project

Updated codebase to follow consistent styling for spacing, braces, and indentation. Changes improve readability and align with standardized conventions throughout SCSS, TypeScript, and HTML files.
This commit is contained in:
Teriuihi 2025-04-05 18:19:10 +02:00
parent 5bf9c725f4
commit a993c1cc3e
21 changed files with 107 additions and 86 deletions

View File

@ -1,5 +1,5 @@
import { TestBed } from '@angular/core/testing';
import { AppComponent } from './app.component';
import {TestBed} from '@angular/core/testing';
import {AppComponent} from './app.component';
describe('AppComponent', () => {
beforeEach(async () => {

View File

@ -9,7 +9,7 @@ import {Router} from '@angular/router';
templateUrl: './app.component.html',
styleUrl: './app.component.scss',
})
export class AppComponent implements OnInit{
export class AppComponent implements OnInit {
title = 'Survival Minecraft Server on ' + ALTITUDE_VERSION + '! | Altitude Community';
title_og = 'Community-centered ' + ALTITUDE_VERSION + ' Survival Minecraft Server';
description = 'Start your adventure today! We are a ' +
@ -28,11 +28,11 @@ export class AppComponent implements OnInit{
ngOnInit(): void {
this.titleService.setTitle(this.title)
this.metaService.updateTag({ name: 'description', content: this.description});
this.metaService.updateTag({ name: 'twitter:description', content: this.description_og})
this.metaService.updateTag({ name: 'og:title', content: this.title_og})
this.metaService.updateTag({ name: 'og:description', content: this.description_og})
this.metaService.updateTag({ name: 'keywords', content: this.keywords})
this.metaService.updateTag({name: 'description', content: this.description});
this.metaService.updateTag({name: 'twitter:description', content: this.description_og})
this.metaService.updateTag({name: 'og:title', content: this.title_og})
this.metaService.updateTag({name: 'og:description', content: this.description_og})
this.metaService.updateTag({name: 'keywords', content: this.keywords})
}
public isHomePage(): boolean {

View File

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

View File

@ -1,24 +1,24 @@
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import {NgModule} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import {AppComponent} from './app.component';
import {RouterModule, Routes} from '@angular/router';
import { HeaderComponent } from './header/header.component';
import { HomeComponent } from './home/home.component';
import {HeaderComponent} from './header/header.component';
import {HomeComponent} from './home/home.component';
import {NgOptimizedImage} from '@angular/common';
import {ThemeComponent} from "./theme/theme.component";
import {CookieService} from 'ngx-cookie-service';
const routes: Routes = [
{ path: '', component: HomeComponent }
{path: '', component: HomeComponent}
];
@NgModule({
declarations: [
AppComponent,
HeaderComponent,
HomeComponent,
ThemeComponent
],
declarations: [
AppComponent,
HeaderComponent,
HomeComponent,
ThemeComponent
],
imports: [
BrowserModule,
RouterModule.forRoot(routes),
@ -27,4 +27,5 @@ const routes: Routes = [
providers: [CookieService],
bootstrap: [AppComponent]
})
export class AppModule { }
export class AppModule {
}

View File

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

View File

@ -1,5 +1,6 @@
export const ALTITUDE_VERSION = "1.21"
export const enum THEME_MODE {
LIGHT= 'theme-light',
LIGHT = 'theme-light',
DARK = 'theme-dark'
}

View File

@ -65,8 +65,7 @@
</div>
<a href="/"><img ngSrc="/public/img/logos/logo.png" alt="Altitude Server Logo" height="319" width="550"></a>
<ul id="nav_list">
<li class="nav_li"><a [id]="[current_page === 'index' ? 'current-page' : null]" class="nav_link"
href="/">Home</a>
<li class="nav_li"><a [id]="getCurrentPageId(['home'])" class="nav_link" href="/">Home</a>
</li>
<li class="nav_li">
<span [id]="getCurrentPageId(['map', 'customfeatures', 'economy', 'events', 'mypet', 'warps',

View File

@ -31,7 +31,7 @@ header .container {
#nav.active {
height: 80px;
background-color: var(--color-primary);
box-shadow: 0 2px 3px -1px rgba(30,30,30,0.1);
box-shadow: 0 2px 3px -1px rgba(30, 30, 30, 0.1);
}
.nav_link.active {
@ -49,7 +49,7 @@ nav img {
.nav_li {
display: inline;
font-family: 'minecraft-title',sans-serif;
font-family: 'minecraft-title', sans-serif;
color: #333333;
position: relative;
}
@ -162,7 +162,7 @@ nav img {
border-radius: 3px;
z-index: 1;
transform-origin: 4px 0;
transition: transform 0.5s cubic-bezier(0.77,0.2,0.05,1.0), background 0.5s cubic-bezier(0.77,0.2,0.05,1.0), opacity 0.55s ease;
transition: transform 0.5s cubic-bezier(0.77, 0.2, 0.05, 1.0), background 0.5s cubic-bezier(0.77, 0.2, 0.05, 1.0), opacity 0.55s ease;
}
#mobile_nav_list {
@ -177,13 +177,13 @@ nav img {
list-style-type: none;
transform-origin: 0 0;
transform: translate(-100%, 0);
transition: transform 0.5s cubic-bezier(0.77,0.2,0.05,1.0);
transition: transform 0.5s cubic-bezier(0.77, 0.2, 0.05, 1.0);
}
#mobile_nav_list li {
padding: 10px 0;
font-size: 1.2em;
font-family: 'opensans-bold',sans-serif;
font-family: 'opensans-bold', sans-serif;
text-align: left;
}
@ -221,7 +221,7 @@ nav img {
.nav_li {
display: inline;
font-family: 'minecraft-title',sans-serif;
font-family: 'minecraft-title', sans-serif;
color: #333333;
position: relative;
}
@ -249,7 +249,7 @@ nav img {
transition-delay: 0.1s;
font-size: 0.9em;
min-width: 160px;
box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2);
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2);
z-index: 1;
text-align: left;
width: 200px;
@ -312,7 +312,7 @@ nav img {
content: '';
width: 44px;
height: 44px;
box-shadow: 0 0 0 0 rgba(255,255,255,.1);
box-shadow: 0 0 0 0 rgba(255, 255, 255, .1);
border-radius: 100%;
opacity: 0;
-webkit-animation: sdb03 3s infinite;
@ -330,7 +330,7 @@ nav img {
}
60% {
box-shadow: 0 0 0 60px rgba(255,255,255,.1);
box-shadow: 0 0 0 60px rgba(255, 255, 255, .1);
opacity: 0;
}
@ -349,7 +349,7 @@ nav img {
}
60% {
box-shadow: 0 0 0 60px rgba(255,255,255,.1);
box-shadow: 0 0 0 60px rgba(255, 255, 255, .1);
opacity: 0;
}
@ -359,13 +359,13 @@ nav img {
}
@-moz-document url-prefix() {
.dropdown2{
.dropdown2 {
top: 12px;
}
}
@supports (-ms-ime-align:auto) {
.dropdown2{
.dropdown2 {
top: 0;
}
}

View File

@ -1,6 +1,6 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import {ComponentFixture, TestBed} from '@angular/core/testing';
import { HeaderComponent } from './header.component';
import {HeaderComponent} from './header.component';
describe('HeaderComponent', () => {
let component: HeaderComponent;
@ -10,7 +10,7 @@ describe('HeaderComponent', () => {
await TestBed.configureTestingModule({
imports: [HeaderComponent]
})
.compileComponents();
.compileComponents();
fixture = TestBed.createComponent(HeaderComponent);
component = fixture.componentInstance;

View File

@ -10,9 +10,9 @@ import {ALTITUDE_VERSION} from '../constant';
export class HeaderComponent {
@Input() title: string = '';
@Input() sub_title: string = '';
@Input() current_page: string = ''
@Input() current_page: string = '';
public active: string = ''
public active: string = '';
@HostListener('window:scroll', [])
onWindowScroll(): void {
@ -27,7 +27,7 @@ export class HeaderComponent {
scrollToSection(): void {
const element = document.getElementById('scrollingpoint');
if (element) {
element.scrollIntoView({ behavior: 'smooth', block: 'start' });
element.scrollIntoView({behavior: 'smooth', block: 'start'});
} else {
console.error('Element with id "scrollingpoint" not found.');
}

View File

@ -2,10 +2,10 @@
<app-header [title]="'Altitude'" [current_page]="'home'"></app-header>
<main>
<section id="scrollingpoint" style="background: #202020; text-align: center; padding: 80px 0px;">
<!-- TODO load player count from old api or backend?-->
<!-- TODO load player count from old api or backend?-->
<h2 style="color: white;"><span class="player-count">Loading...</span></h2>
<h2 style="color: white;">Server IP: play.alttd.com</h2>
<!-- TODO make copy be angular not js-->
<!-- TODO make copy be angular not js-->
<button type="button" style="margin-top: 50px;" class="button-outer" onclick="copyToClipboard('play.alttd.com')">
<span class="button-inner" id="copybutton">Copy IP</span>
</button>
@ -14,9 +14,12 @@
<div class="container">
<div class="paragraph">
<h2>Adventure Begins</h2>
<p>You awake in a strange town, where are you? There are residents running about trading with each other and stories of distant realms with more towns. It's time to write your story. Welcome to Altitude, the laid-back community-oriented server that hosts your home for Minecraft.</p>
<p>You awake in a strange town, where are you? There are residents running about trading with each other and
stories of distant realms with more towns. It's time to write your story. Welcome to Altitude, the laid-back
community-oriented server that hosts your home for Minecraft.</p>
</div>
<img ngSrc="/public/img/items/bookquill.png" style="width: 150px; align-self: center; margin: 0 auto;" alt="Alternative Altitude Server Logo"
<img ngSrc="/public/img/items/bookquill.png" style="width: 150px; align-self: center; margin: 0 auto;"
alt="Alternative Altitude Server Logo"
height="150" width="150">
</div>
</section>
@ -38,7 +41,9 @@
<iframe id="discordwidget" src="https://discordapp.com/widget?id=141644560005595136&theme=dark"></iframe>
<div class="paragraph" id="discordp">
<h2>Meet the Community</h2>
<p>Altitude is home to players young and old from all around the globe, and here, everyone is family. Altitude is your place to get together with friends and relax - and maybe enjoy some survival too. Altitude is intended for older players, but all are welcome!</p>
<p>Altitude is home to players young and old from all around the globe, and here, everyone is family. Altitude
is your place to get together with friends and relax - and maybe enjoy some survival too. Altitude is
intended for older players, but all are welcome!</p>
<p>Don't have Discord? Keep up with news and announcements at the <a href="alttd.com/blog">blog</a>.</p>
<div style="display: flex; justify-content: center;">
<a target="_blank" rel="noopener" href="https://discordapp.com/invite/TGqpzCJ">
@ -53,11 +58,14 @@
<section id="section2">
<div class="customcontainer">
<h2 style="color: white; padding-bottom: 35px; font-size:2.8em">Survival Shaped by You</h2>
<p style="color: white; padding-bottom: 35px; margin: auto; font-size: 1.1em;">Altitude is built by the community, for the community. We've added features requested by our members and several custom plugins to create our "perfect" survival experience.</p>
<p style="color: white; padding-bottom: 35px; margin: auto; font-size: 1.1em;">Altitude is built by the
community, for the community. We've added features requested by our members and several custom plugins to
create our "perfect" survival experience.</p>
<div id="customcontainer2">
<div class="customcontainer3">
<h2>McMMO & MyPet</h2>
<p>Two of the most requested plugins on Altitude, level up yourself and your pet with these MMO-based plugins!</p>
<p>Two of the most requested plugins on Altitude, level up yourself and your pet with these MMO-based
plugins!</p>
<a [routerLink]="['/mypet']">
<div class="button-outer">
<span class="button-inner">MyPet Info</span>
@ -66,7 +74,8 @@
</div>
<div class="customcontainer3">
<h2>Dynamic map</h2>
<p>See the world and the players around it in real-time! The map shows the entire survival world with claims and warps.</p>
<p>See the world and the players around it in real-time! The map shows the entire survival world with claims
and warps.</p>
<a [routerLink]="['/map']">
<div class="button-outer">
<span class="button-inner">Visit Map</span>
@ -75,7 +84,8 @@
</div>
<div class="customcontainer3">
<h2>Player Shops</h2>
<p>Our economy is built on player shops, encouraging player interaction and putting the control in your hands.</p>
<p>Our economy is built on player shops, encouraging player interaction and putting the control in your
hands.</p>
<a [routerLink]="['/economy']">
<div class="button-outer">
<span class="button-inner">Shop Guide</span>
@ -101,7 +111,9 @@
</section>
<section style="background: #202020;">
<div class="customcontainer">
<h2 id="quote" style="color: white; font-family: 'minecraft-text',sans-serif; line-height: 1.3em;">"Great community, great people, great server all round . . . If it can bring back my love for minecraft, it could work wonders for you."</h2>
<h2 id="quote" style="color: white; font-family: 'minecraft-text',sans-serif; line-height: 1.3em;">"Great
community, great people, great server all round . . . If it can bring back my love for minecraft, it could
work wonders for you."</h2>
<p style="color: white; margin-top:30px;">- /u/seanhanley1993</p>
</div>
</section>
@ -110,7 +122,7 @@
<img ngSrc="/public/img/logos/log.png" alt="Alternative Altitude Server Logo" height="129"
width="120">
<h2 style="margin: 20px 0; font-size: 1.8em;">play.alttd.com</h2>
<!-- TODO make this use angular not js-->
<!-- TODO make this use angular not js-->
<button type="button" class="button-outer" onclick="copyToClipboard('play.alttd.com')">
<span class="button-inner" id="copybutton2">Copy IP</span>
</button>

View File

@ -1,6 +1,6 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import {ComponentFixture, TestBed} from '@angular/core/testing';
import { HomeComponent } from './home.component';
import {HomeComponent} from './home.component';
describe('HomeComponent', () => {
let component: HomeComponent;
@ -10,7 +10,7 @@ describe('HomeComponent', () => {
await TestBed.configureTestingModule({
imports: [HomeComponent]
})
.compileComponents();
.compileComponents();
fixture = TestBed.createComponent(HomeComponent);
component = fixture.componentInstance;

View File

@ -9,7 +9,8 @@ import {ALTITUDE_VERSION} from '../constant';
styleUrl: './home.component.scss'
})
export class HomeComponent implements OnInit {
constructor(private titleService: Title) {}
constructor(private titleService: Title) {
}
ngOnInit(): void {
this.titleService.setTitle('Survival Minecraft Server on ' + ALTITUDE_VERSION + ' | Altitude Community');
@ -23,6 +24,7 @@ export class HomeComponent implements OnInit {
];
private slideIndex = 0;
get slide(): string {
return this.slides[this.slideIndex];
}

View File

@ -6,7 +6,7 @@
height: 25px;
}
.switch-div{
.switch-div {
right: 40px;
}

View File

@ -1,6 +1,6 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import {ComponentFixture, TestBed} from '@angular/core/testing';
import { ThemeComponent } from './theme.component';
import {ThemeComponent} from './theme.component';
describe('ThemeComponent', () => {
let component: ThemeComponent;
@ -10,7 +10,7 @@ describe('ThemeComponent', () => {
await TestBed.configureTestingModule({
imports: [ThemeComponent]
})
.compileComponents();
.compileComponents();
fixture = TestBed.createComponent(ThemeComponent);
component = fixture.componentInstance;

View File

@ -13,7 +13,8 @@ export class ThemeComponent implements OnInit, OnDestroy {
isDarkMode: boolean = false;
private themeSubscription: Subscription | null = null;
constructor(private themeService: ThemeService) {}
constructor(private themeService: ThemeService) {
}
ngOnInit(): void {
this.themeSubscription = this.themeService.theme$.subscribe(theme => {

View File

@ -1,6 +1,6 @@
import { TestBed } from '@angular/core/testing';
import {TestBed} from '@angular/core/testing';
import { ThemeService } from './theme.service';
import {ThemeService} from './theme.service';
describe('ThemeService', () => {
let service: ThemeService;

View File

@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { CookieService } from 'ngx-cookie-service';
import { BehaviorSubject } from 'rxjs';
import {Injectable} from '@angular/core';
import {CookieService} from 'ngx-cookie-service';
import {BehaviorSubject} from 'rxjs';
import {THEME_MODE} from '../constant';
@Injectable({
@ -22,9 +22,14 @@ export class ThemeService {
: THEME_MODE.DARK;
let currentTheme: THEME_MODE;
switch (savedTheme) {
case THEME_MODE.DARK: currentTheme = THEME_MODE.DARK; break;
case THEME_MODE.DARK: {
currentTheme = THEME_MODE.DARK;
break;
}
case THEME_MODE.LIGHT:
default: currentTheme = THEME_MODE.LIGHT;
default: {
currentTheme = THEME_MODE.LIGHT;
}
}
this.setTheme(currentTheme);
}

View File

@ -9,21 +9,21 @@
<meta name="theme-color" content="#1f9bde">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<!-- Twitter Card data -->
<meta name="twitter:card" content="summary" />
<meta name="twitter:title" content="Community-centered Survival Minecraft Server" />
<meta name="twitter:card" content="summary"/>
<meta name="twitter:title" content="Community-centered Survival Minecraft Server"/>
<!-- Twitter Summary card images must be at least 120x120px -->
<meta name="twitter:image" content="https://www.alttd.com/assets/img/random/seo.jpg" />
<meta name="twitter:image" content="https://www.alttd.com/assets/img/random/seo.jpg"/>
<!-- Open Graph data -->
<meta property="og:type" content="article" />
<meta property="og:url" content="https://www.alttd.com/" />
<meta property="og:image" content="https://www.alttd.com/assets/img/random/seo.jpg" />
<meta property="og:site_name" content="Altitude Community" />
<meta property="og:type" content="article"/>
<meta property="og:url" content="https://www.alttd.com/"/>
<meta property="og:image" content="https://www.alttd.com/assets/img/random/seo.jpg"/>
<meta property="og:site_name" content="Altitude Community"/>
<link rel="icon" type="image/x-icon" href="public/favicon.ico">
<style>
header {
height: 460px;
background: linear-gradient( rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5) ), url("public/img/backgrounds/trees.jpg");
background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url("public/img/backgrounds/trees.jpg");
background-size: cover;
background-position: center;
background-repeat: no-repeat;
@ -31,6 +31,6 @@
</style>
</head>
<body>
<app-root></app-root>
<app-root></app-root>
</body>
</html>

View File

@ -1,5 +1,5 @@
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
import {AppModule} from './app/app.module';
platformBrowserDynamic()
.bootstrapModule(AppModule)

View File

@ -1,4 +1,4 @@
:root{
:root {
--white: #FFFFFF;
--black: #282828;
--pureblack: #000000;