Skip to content

Commit 6f701ca

Browse files
committed
bug: got a appendchild error that stops compiler
1 parent 4a1a263 commit 6f701ca

File tree

15 files changed

+225
-194
lines changed

15 files changed

+225
-194
lines changed

src/components/vertical-nav/breadcrumbs-nav.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
enum LinkCategory {
22
HOME = "#3BFFC5",
3-
INTERACTIVES = "#3B62FF",
3+
INTERACTIVE = "#3B62FF",
44
PROJECT = "#1E1E1E",
55
}
66

@@ -12,7 +12,7 @@ type BreadcrumbLink = [
1212

1313
const CURRENT_TRACK: BreadcrumbLink[] = [
1414
["home", "/", LinkCategory.HOME],
15-
["interactives", "/interactives", LinkCategory.INTERACTIVES],
15+
["interactive", "/interactive", LinkCategory.INTERACTIVE],
1616
["space compass", "/space-compass", LinkCategory.PROJECT],
1717
]
1818

src/components/vertical-nav/footer-nav.ts

Lines changed: 0 additions & 52 deletions
This file was deleted.

src/components/vertical-nav/header-nav.ts

Lines changed: 0 additions & 29 deletions
This file was deleted.
Lines changed: 103 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,118 @@
11
import './styles.css';
2-
import {headerNav} from "./header-nav.ts";
3-
import {footerNav} from "./footer-nav.ts";
42
import {trackBreadcrumbs} from "./breadcrumbs-nav.ts";
5-
import {renderInfo} from "./info-nav.ts";
6-
export * from "./header-nav.ts";
7-
export * from "./breadcrumbs-nav.ts";
8-
export * from "./footer-nav.ts";
3+
4+
import cdIcon from "/img/common/cd_icon_green.png";
5+
import githubIcon from "./assets/github-icon.svg";
6+
import linkedIcon from "./assets/linkedin-icon.svg";
7+
import instagramIcon from "./assets/instagram-icon.svg";
8+
9+
const navTitle = "CD-BASH";
10+
const githubProfile: string = "https://github.com/CD-BASH"
11+
const linkedinProfile: string = "https://www.linkedin.com/in/charlesdouc/"
12+
const instagramProfile: string = "https://www.instagram.com/charlesdouc/"
13+
const footerCopyrights: string = "© 2025 Charles Doucet - All Rights Reserved";
14+
15+
16+
type SocialLink = [
17+
path: string,
18+
image: string,
19+
]
20+
21+
const FOO_SOCIALS: SocialLink[] = [
22+
[githubProfile, githubIcon],
23+
[linkedinProfile, linkedIcon],
24+
[instagramProfile, instagramIcon]
25+
]
26+
927

1028
//-----------------------------------------------------------------------
1129

12-
export function verticalNav() {
30+
export function buildVerticalNav() {
1331
const navBox = document.createElement("div");
1432
const navWrapper = document.createElement("div");
1533

1634
navBox.id = "vertical-nav";
17-
navWrapper.className = "nav-wrapper";
18-
35+
navWrapper.id = "nav-wrapper";
1936

20-
navBox.appendChild(headerNav());
37+
navBox.appendChild(header());
2138
navBox.appendChild(navWrapper);
2239
navWrapper.appendChild(trackBreadcrumbs());
23-
navWrapper.appendChild(renderInfo());
24-
navBox.appendChild(footerNav());
40+
navBox.appendChild(footer());
2541

2642
return navBox;
43+
}
44+
45+
export function renderNavInfo(infoFn: Function) {
46+
const wrapper = clearInfo();
47+
const info = infoFn();
48+
49+
wrapper?.appendChild(info);
50+
}
51+
52+
//-----------------------------------------------------------------------
53+
54+
function header() {
55+
const container = document.createElement("div");
56+
const topTriangle = document.createElement("div");
57+
const info = document.createElement("div");
58+
const icon = document.createElement("img");
59+
const title = document.createElement("h5");
60+
61+
container.className = "header";
62+
topTriangle.className = "top-triangle";
63+
64+
info.className = "info";
65+
icon.className = "icon";
66+
icon.src = cdIcon;
67+
68+
title.textContent = navTitle;
69+
70+
container.appendChild(topTriangle);
71+
container.appendChild(info);
72+
info.appendChild(icon);
73+
info.appendChild(title);
74+
75+
return container;
76+
}
77+
78+
79+
function footer() {
80+
const container = document.createElement("div");
81+
const socials = document.createElement("ul");
82+
const copyrights = document.createElement("p");
83+
84+
container.className = "nav-footer";
85+
socials.className = "socials";
86+
copyrights.className = "copyrights";
87+
copyrights.textContent = footerCopyrights;
88+
89+
container.appendChild(socials);
90+
container.appendChild(copyrights);
91+
92+
FOO_SOCIALS.forEach(social => {
93+
const [path, image] = social;
94+
const socialLink = document.createElement("li");
95+
const link = document.createElement("a");
96+
const icon = document.createElement("img");
97+
98+
link.href = path;
99+
link.target = "_blank";
100+
icon.src = image;
101+
102+
socials.appendChild(socialLink);
103+
socialLink.appendChild(link);
104+
link.appendChild(icon);
105+
})
106+
107+
return container;
108+
}
109+
110+
111+
function clearInfo() {
112+
const cleanInfo = document.getElementById('nav-wrapper');
113+
cleanInfo?.childNodes.forEach((childNode) => {
114+
cleanInfo.removeChild(childNode);
115+
});
116+
117+
return cleanInfo;
27118
}

src/components/vertical-nav/info-nav.ts

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/components/vertical-nav/project-nav.ts

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,34 @@
1-
export type AboutProject = [
2-
release: string,
3-
platforms: string,
4-
developer: string
5-
]
1+
export type AboutProject = {
2+
readonly release: string;
3+
readonly platforms: string;
4+
readonly developer: string;
5+
}
66

77
export type RelatedLinks = [
88
name: string,
99
path: string,
1010
]
1111

12+
//-----------------------------------------------------------------------
13+
1214
export function projectInfo(about: AboutProject, links: RelatedLinks[]) {
13-
const info = document.createElement("div");
15+
const navWrapper = document.getElementById('nav-wrapper');
16+
17+
if (about != null && navWrapper != null) {
18+
navWrapper?.appendChild(sectionAboutTheGame(about));
1419

15-
if (about != null) {
16-
info.appendChild(sectionAboutTheGame(about));
1720
}
1821

1922
if (links != null) {
20-
info.appendChild(sectionRelatedLinks(links));
23+
navWrapper?.appendChild(sectionRelatedLinks(links));
2124
}
25+
26+
return navWrapper;
2227
}
2328

29+
//-----------------------------------------------------------------------
2430

2531
function sectionAboutTheGame(about: AboutProject) {
26-
const [release, platforms, developer] = about;
27-
2832
const detailSection = document.createElement('div');
2933
const detailTitle = document.createElement("h4");
3034
const releaseDate = document.createElement("p");
@@ -33,9 +37,9 @@ function sectionAboutTheGame(about: AboutProject) {
3337

3438
detailSection.className = "detail-section";
3539
detailTitle.textContent = "About the Project"
36-
releaseDate.textContent = "<b>Release date: </b>" + release;
37-
platformAvailable.textContent = "<b>Platforms: </b" + platforms;
38-
developerNames.textContent = "<b>Developer: </b>" + developer;
40+
releaseDate.textContent = "<b>Release date: </b>" + about.release;
41+
platformAvailable.textContent = "<b>Platforms: </b" + about.platforms;
42+
developerNames.textContent = "<b>Developer: </b>" + about.developer;
3943

4044
detailSection.appendChild(detailTitle);
4145
detailSection.appendChild(releaseDate);

src/components/vertical-nav/styles.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
background-color: #080808;
88
box-shadow: 0px 0px 0px 16px rgba(8,8,8,0.5), 0px 0px 0px 8px rgba(8,8,8,0.5);
99

10-
.nav-wrapper {
10+
#nav-wrapper {
1111
width: 230px;
1212
margin: 0 auto;
1313
}

src/components/vertical-nav/vertical-nav.ts renamed to src/consts/toBeDeleted.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import './styles.css'
1+
import '../components/vertical-nav/styles.css'
22

3-
import {EventBus} from "../../event-bus";
4-
import {Events} from "../../consts/events";
5-
import {handlers} from "../../consts/handlers";
3+
import {EventBus} from "../event-bus";
4+
import {Events} from "./events";
5+
import {handlers} from "./handlers";
66

77
const EVENT_BUS = new EventBus<Events>();
88
EVENT_BUS.subscribe('button_test', handlers.button_test);

src/content/projects/space-compass/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {renderProjectPage} from "../../../views/project-view";
1+
import {projectView} from "../../../views/project-view";
22
import {ProjectContent} from "../../../views/project-view";
33

44
import WEBM_VIDEO from "./assets/spaceCompass-showcase.webm";
@@ -33,5 +33,5 @@ const content: ProjectContent = {
3333
}
3434

3535
export function ProjectPage() {
36-
return renderProjectPage(content);
36+
return projectView(content);
3737
}

src/content/projects/tank/index.ts

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import {renderProjectPage} from "../../../views/project-view";
2-
import {ProjectContent} from "../../../views/project-view/project-view";
1+
import {projectView} from "../../../views/project-view";
2+
import {ProjectContent} from "../../../views/project-view/";
3+
import {AboutProject, projectInfo, RelatedLinks} from "../../../components/vertical-nav/project-nav.ts";
34

45
import WEBM_VIDEO from "./assets/tank-showcase.webm";
56
import MP4_VIDEO from "./assets/tank-showcase.mp4";
@@ -9,6 +10,7 @@ import SCREENSHOT_2 from "./assets/tank-screenshot-2.jpg"
910
import SCREENSHOT_3 from "./assets/tank-screenshot-3.jpg"
1011
import SCREENSHOT_4 from "./assets/tank-screenshot-4.jpg"
1112

13+
1214
const content: ProjectContent = {
1315
name: "TANK",
1416
tagline: "A collection of three unique iterations",
@@ -32,6 +34,24 @@ const content: ProjectContent = {
3234
]
3335
}
3436

35-
export function ProjectPage() {
36-
return renderProjectPage(content);
37+
const aboutInfo: AboutProject = {
38+
release: "April 29, 2018",
39+
platforms: "Windows, Mac",
40+
developer: "Charles Doucet"
41+
}
42+
43+
const relatedLinksInfo: RelatedLinks[] = [
44+
["Process Journal", "https://github.com/charlesDouc/CART-415/wiki"],
45+
["GitHub Project", "https://github.com/charlesDouc/CART-415/wiki"],
46+
["TANKS!", "https://github.com/charlesDouc/CART-415/wiki"]
47+
]
48+
49+
//-----------------------------------------------------------------------
50+
51+
export function TankView() {
52+
return projectView(content);
53+
}
54+
55+
export function TankInfo() {
56+
return projectInfo(aboutInfo, relatedLinksInfo);
3757
}

0 commit comments

Comments
 (0)