Skip to content
This repository was archived by the owner on Aug 19, 2023. It is now read-only.

Commit d73c5aa

Browse files
CitralFloHyd3r1
andauthored
GH-95 All project section (#95)
* Initial commit * Change styling to match site contents * Change styling of button for all-projects section. Add hover effect, set label with status display. Add timeout for GitHub fetch to match time of fetching pinned repositories. * Extend timeout to 3sec * Styling changes and remove on/off status from toggle status label * Delete button, set label to toggle list, use language file for section title * Match background color with projects above * Delete AllProjects.vue, fetch all projects from repository to our site. Ignore .github project. * Set placeholder icon for all repositories w/o one. Set order of repositories based on pinned status (not working yet) * Set reorder method for projects. Run into problems :/ * Check solution for projects.ts * style correction * Fix unused lang settings, fix Project.vue style from Projects.vue. Add ProjectsFetch.ts, add all-projects component * Add language detection of projects, add corresponding project icon * Change arrow pointer for dropdown text * add user-select: none; * Cleanup code * Cleanup code * Add scroll into view for button press --------- Co-authored-by: Krzysztof Haller <[email protected]>
1 parent 69fb677 commit d73c5aa

File tree

10 files changed

+290
-96
lines changed

10 files changed

+290
-96
lines changed
16.8 KB
Loading
7.84 KB
Loading
2.17 KB
Loading
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
<template>
2+
<section id="all-projects">
3+
<div class="all-projects-section">
4+
<label class="others-status" @click="toggleActive">
5+
{{ $t("message.projects.other") }}
6+
<svg
7+
class="arrow" :class="{ active: isActive}"
8+
aria-hidden="true"
9+
fill="currentColor"
10+
viewBox="0 0 20 20"
11+
xmlns="http://www.w3.org/2000/svg">
12+
<path
13+
clip-rule="evenodd"
14+
d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z"
15+
fill-rule="evenodd"></path>
16+
</svg>
17+
</label>
18+
<div class="all-projects-tab-container">
19+
<div id="all-projects-tab" class="all-projects-tab" :class="{ active: isActive}">
20+
<div class="row projects-row">
21+
<Project v-for="(project, index) in projects"
22+
:key="index"
23+
:name="project.name"
24+
:description="project.description"
25+
:githubUrl="`https://github.com/EternalCodeTeam/${project.name}`"
26+
:imageUrl="'/assets/img/projects/language/' + project.language + '.webp'"
27+
/>
28+
</div>
29+
</div>
30+
</div>
31+
</div>
32+
</section>
33+
</template>
34+
35+
<script>
36+
37+
import Project from "@/components/projects/components/Project.vue";
38+
import {notPinnedProjects} from "@/components/projects/ProjectsFetch.ts";
39+
40+
export default {
41+
name: "Projects",
42+
components: {
43+
Project
44+
},
45+
data() {
46+
return {
47+
projects: [],
48+
isActive: false,
49+
};
50+
},
51+
mounted() {
52+
notPinnedProjects.then((projects) => this.projects = projects);
53+
},
54+
methods: {
55+
toggleActive() {
56+
this.isActive = !this.isActive;
57+
if (this.isActive) {
58+
setTimeout(() => {
59+
document.getElementById("all-projects-tab").scrollIntoView({behavior: "auto"});
60+
}, 290);
61+
}
62+
},
63+
},
64+
};
65+
</script>
66+
67+
<style>
68+
#all-projects {
69+
padding: 0 12% 3% 12%;
70+
}
71+
72+
.arrow {
73+
width: 60px;
74+
height: auto;
75+
transition: 0.3s ease-in-out
76+
}
77+
78+
.arrow.active {
79+
transform: rotate(-180deg);
80+
}
81+
82+
83+
.all-projects-tab-container {
84+
overflow: hidden;
85+
}
86+
87+
.others-status {
88+
display: inline-block;
89+
color: var(--primary-title);
90+
font-weight: 800;
91+
user-select: none;
92+
font-size: 30px;
93+
cursor: pointer;
94+
}
95+
96+
.all-projects-tab {
97+
z-index: -1;
98+
margin-top: -110vh;
99+
transition-duration: 0.5s;
100+
opacity: 1;
101+
}
102+
103+
.all-projects-tab.active {
104+
display: block;
105+
margin-top: 50px;
106+
transition-duration: 0.5s;
107+
opacity: 1;
108+
}
109+
110+
.row.projects-row img {
111+
width: 65%;
112+
}
113+
114+
115+
#all-projects > div {
116+
margin: 0;
117+
padding: 0;
118+
}
119+
120+
.others-status {
121+
z-index: 3;
122+
width: 100%;
123+
text-align: center;
124+
margin: auto;
125+
}
126+
127+
@media only screen and (max-width: 1000px) {
128+
.all-projects-section {
129+
position: center;
130+
padding: 5px;
131+
}
132+
133+
.all-projects-tab {
134+
margin-top: -500vh;
135+
}
136+
137+
}
138+
</style>

src/components/projects/Projects.vue

Lines changed: 26 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@
44
<p>{{ $t("message.projects.subtitle") }}</p>
55
<div class="row projects-row">
66
<Project
7-
v-for="(project, index) in projects"
7+
v-for="(project, index) in this.projects"
88
:key="index"
9+
:name="project.name"
910
:description="project.description"
11+
:imageUrl="'/assets/img/projects/logo/' + project.name + '_icon.webp'"
1012
:githubUrl="project.link"
11-
:hrefText="$t('message.projects.more')"
12-
:imageUrl="'/assets/img/projects/logo/' + project.repo + '_icon.webp'"
13-
:modrinthUrl="projectLinks[project.repo]?.modrinth"
14-
:name="project.repo"
15-
:spigotUrl="projectLinks[project.repo]?.spigotmc"
13+
:spigotUrl="projectLinks[project.name]?.spigotmc"
14+
:modrinthUrl="projectLinks[project.name]?.modrinth"
1615
/>
1716
</div>
1817
</section>
@@ -21,6 +20,7 @@
2120
<script>
2221
import Project from "./components/Project.vue";
2322
import projectLinks from "@/info/project_links.json";
23+
import {pinnedProjects} from "@/components/projects/ProjectsFetch.ts";
2424
2525
export default {
2626
name: "Projects",
@@ -34,12 +34,8 @@ export default {
3434
};
3535
},
3636
mounted() {
37-
fetch("https://gh-pinned-repos.egoist.dev/?username=eternalcodeteam")
38-
.then(response => response.json())
39-
.then(data => {
40-
this.projects = data;
41-
});
42-
},
37+
pinnedProjects.then((projects) => this.projects = projects);
38+
}
4339
};
4440
</script>
4541

@@ -54,42 +50,6 @@ export default {
5450
margin: 10px 0;
5551
}
5652
57-
@media only screen and (max-width: 1000px) {
58-
#projects {
59-
padding: 3% 12%;
60-
}
61-
62-
#projects h1 {
63-
font-size: 30px;
64-
}
65-
66-
#projects p {
67-
font-size: small;
68-
margin-bottom: 15%;
69-
}
70-
71-
#projects img {
72-
width: 40%;
73-
margin-bottom: 10%;
74-
}
75-
76-
#projects .card-pro {
77-
margin-bottom: 5%;
78-
padding: 15% 10% 15% 12%;
79-
display: flex;
80-
align-items: center;
81-
justify-content: center;
82-
}
83-
84-
.card-pro h5 {
85-
color: var(--primary-title);
86-
}
87-
88-
.card-pro h6 {
89-
color: var(--secondary-title);
90-
}
91-
}
92-
9353
#projects {
9454
padding: 3% 12% 3% 12%;
9555
}
@@ -117,36 +77,27 @@ export default {
11777
width: 65%;
11878
}
11979
120-
.card-pro {
121-
background-color: var(--light-gray);
122-
border-radius: 12px;
123-
margin-bottom: 2%;
124-
padding: 6% 10%;
125-
transition: 0.5s;
126-
height: 100%;
127-
}
128-
129-
.card-pro a:hover {
130-
color: #707070;
131-
transition: 0.5s;
132-
}
80+
@media only screen and (max-width: 1000px) {
81+
#projects {
82+
padding: 3% 12%;
83+
margin: auto;
84+
justify-content: center;
85+
align-items: center;
86+
}
13387
134-
.card-pro h5 {
135-
color: var(--secondary-title);
136-
font-weight: 600;
137-
}
88+
#projects h1 {
89+
font-size: 30px;
90+
}
13891
92+
#projects p {
93+
font-size: small;
94+
margin-bottom: 15%;
95+
}
13996
140-
.card-pro h6 {
141-
color: rgb(114, 114, 114);
142-
font-weight: 400;
143-
font-size: small;
144-
}
97+
#projects img {
98+
width: 70%;
99+
margin-bottom: 10%;
100+
}
145101
146-
.card-pro a {
147-
font-size: small;
148-
text-decoration: none;
149-
color: #a6abaf;
150102
}
151-
152103
</style>
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
type Project = {
2+
name: string,
3+
description: string,
4+
link: string,
5+
}
6+
7+
const EGOIST_PINNED_REPOS_URL = "https://gh-pinned-repos.egoist.dev/?username=eternalcodeteam";
8+
type EgoistPinnedProject = {
9+
repo: string,
10+
description: string,
11+
link: string,
12+
}
13+
const pinnedProjects: Promise<Array<Project>> = fetch(EGOIST_PINNED_REPOS_URL)
14+
.then(response => response.json() as Promise<EgoistPinnedProject[]>)
15+
.then(projects => projects.map(project => ({
16+
name: project.repo,
17+
description: project.description,
18+
link: project.link,
19+
})));
20+
21+
const GITHUB_API_URL = "https://api.github.com/users/eternalcodeteam/repos?type=public";
22+
type GithubApiProject = {
23+
name: string,
24+
description: string,
25+
html_url: string,
26+
language: string,
27+
}
28+
const ignoredRepos = [".github"];
29+
30+
const allProjects: Promise<Array<Project>> = fetch(GITHUB_API_URL)
31+
.then(response => response.json() as Promise<GithubApiProject[]>)
32+
.then(projects => projects.filter(project => !ignoredRepos.includes(project.name)))
33+
.then(projects => projects.map(project => ({
34+
name: project.name,
35+
description: project.description,
36+
link: project.html_url,
37+
language: project.language,
38+
})));
39+
40+
const notPinnedProjects: Promise<Array<Project>> = Promise.all([allProjects, pinnedProjects])
41+
.then(([allProjects, pinnedProjects]) => {
42+
const pinned = pinnedProjects.map(project => project.name);
43+
return allProjects.filter(project => !pinned.includes(project.name));
44+
});
45+
46+
export {pinnedProjects, notPinnedProjects};

0 commit comments

Comments
 (0)