From 105c3f8ba59e1ef8e59a4b26df9d7d319828c219 Mon Sep 17 00:00:00 2001 From: AdamBtech <60339324+AdamBtech@users.noreply.github.com> Date: Mon, 26 May 2025 20:55:03 +0200 Subject: [PATCH] Refactoring types / interface in dedicated models --- .../neural-profile-tree.component.ts | 12 +--------- .../header-text-animate-section.component.ts | 9 +------- .../project-card/project-card.component.ts | 22 +----------------- .../projects-list/projects-list.component.ts | 7 ++---- src/app/shared/models/about.model.ts | 12 ++++++++++ src/app/shared/models/header.model.ts | 9 ++++++++ src/app/shared/models/project.model.ts | 23 +++++++++++++++++++ .../section-title/section-title.component.ts | 1 + 8 files changed, 50 insertions(+), 45 deletions(-) create mode 100644 src/app/shared/models/about.model.ts create mode 100644 src/app/shared/models/header.model.ts create mode 100644 src/app/shared/models/project.model.ts diff --git a/src/app/features/about-display/neural-profile-tree/neural-profile-tree.component.ts b/src/app/features/about-display/neural-profile-tree/neural-profile-tree.component.ts index 32674ee..26e6e50 100644 --- a/src/app/features/about-display/neural-profile-tree/neural-profile-tree.component.ts +++ b/src/app/features/about-display/neural-profile-tree/neural-profile-tree.component.ts @@ -1,16 +1,6 @@ import { Component, input, signal, computed } from '@angular/core'; import { CommonModule } from '@angular/common'; - -export interface NeuralProfileNode { - id: string; - title: string; - isExpanded: boolean; - isSelected: boolean; - children?: NeuralProfileNode[]; - level: number; - hasChildren: boolean; - visible: boolean; -} +import { type NeuralProfileNode } from '../../../shared/models/about.model'; @Component({ selector: 'app-neural-profile-tree', diff --git a/src/app/features/header-display/header-text-animate-section/header-text-animate-section.component.ts b/src/app/features/header-display/header-text-animate-section/header-text-animate-section.component.ts index 61c32f4..334660f 100644 --- a/src/app/features/header-display/header-text-animate-section/header-text-animate-section.component.ts +++ b/src/app/features/header-display/header-text-animate-section/header-text-animate-section.component.ts @@ -16,14 +16,7 @@ import { transition, animate, } from '@angular/animations'; - -interface TextItem { - readonly id: number; - readonly text: string; - readonly displayed: string; - readonly isTyping: boolean; - readonly isComplete: boolean; -} +import { type TextItem } from '../../../shared/models/header.model'; // Constants for better maintainability const TYPING_DELAYS = { diff --git a/src/app/features/project-display/components/project-card/project-card.component.ts b/src/app/features/project-display/components/project-card/project-card.component.ts index b7203c3..9c722f5 100644 --- a/src/app/features/project-display/components/project-card/project-card.component.ts +++ b/src/app/features/project-display/components/project-card/project-card.component.ts @@ -8,27 +8,7 @@ import { ElementRef, } from '@angular/core'; -export interface Project { - id: string; - title: string; - status: string; - classification: string; - objective: string; - statusDescription: string; - techStack: string[]; - demoUrl?: string; - codeUrl?: string; - isRedacted: boolean; - caseStudy?: { - title: string; - sections: CaseStudySection[]; - }; -} - -export interface CaseStudySection { - title: string; - content: string; -} +import { type Project } from '../../../../shared/models/project.model'; @Component({ selector: 'app-project-card', diff --git a/src/app/features/project-display/components/projects-list/projects-list.component.ts b/src/app/features/project-display/components/projects-list/projects-list.component.ts index 5011881..773e100 100644 --- a/src/app/features/project-display/components/projects-list/projects-list.component.ts +++ b/src/app/features/project-display/components/projects-list/projects-list.component.ts @@ -1,11 +1,8 @@ // project-list.component.ts import { Component, signal, computed, effect, OnInit } from '@angular/core'; -import { - ProjectCardComponent, - Project, - CaseStudySection, -} from '../project-card/project-card.component'; +import { ProjectCardComponent } from '../project-card/project-card.component'; import { SectionTitleComponent } from '../../../../shared/ui/section-title/section-title.component'; +import { type Project } from '../../../../shared/models/project.model'; @Component({ selector: 'app-project-list', diff --git a/src/app/shared/models/about.model.ts b/src/app/shared/models/about.model.ts new file mode 100644 index 0000000..7e40177 --- /dev/null +++ b/src/app/shared/models/about.model.ts @@ -0,0 +1,12 @@ +type NeuralProfileNode = { + id: string; + title: string; + isExpanded: boolean; + isSelected: boolean; + children?: NeuralProfileNode[]; + level: number; + hasChildren: boolean; + visible: boolean; +}; + +export type { NeuralProfileNode }; diff --git a/src/app/shared/models/header.model.ts b/src/app/shared/models/header.model.ts new file mode 100644 index 0000000..f7d3178 --- /dev/null +++ b/src/app/shared/models/header.model.ts @@ -0,0 +1,9 @@ +type TextItem = { + readonly id: number; + readonly text: string; + readonly displayed: string; + readonly isTyping: boolean; + readonly isComplete: boolean; +}; + +export { type TextItem }; diff --git a/src/app/shared/models/project.model.ts b/src/app/shared/models/project.model.ts new file mode 100644 index 0000000..360fadf --- /dev/null +++ b/src/app/shared/models/project.model.ts @@ -0,0 +1,23 @@ +type Project = { + id: string; + title: string; + status: string; + classification: string; + objective: string; + statusDescription: string; + techStack: string[]; + demoUrl?: string; + codeUrl?: string; + isRedacted: boolean; + caseStudy?: { + title: string; + sections: CaseStudySection[]; + }; +}; + +type CaseStudySection = { + title: string; + content: string; +}; + +export { type Project, type CaseStudySection }; diff --git a/src/app/shared/ui/section-title/section-title.component.ts b/src/app/shared/ui/section-title/section-title.component.ts index a693e39..ae009a5 100644 --- a/src/app/shared/ui/section-title/section-title.component.ts +++ b/src/app/shared/ui/section-title/section-title.component.ts @@ -64,6 +64,7 @@ export class SectionTitleComponent implements OnInit, OnDestroy { const timeoutId = setTimeout(() => { revealedLetters[i] = true; }, i * letterDelay); + // @ts-ignore this.timeoutIds.push(timeoutId); } else { revealedLetters[i] = true; // Spaces are always "revealed"