diff --git a/actions/projects/getProjectBySlug.ts b/actions/getProjectBySlug.ts similarity index 100% rename from actions/projects/getProjectBySlug.ts rename to actions/getProjectBySlug.ts diff --git a/actions/organize/organizeSkillsByCategory.ts b/actions/organizeSkillsByCategory.ts similarity index 100% rename from actions/organize/organizeSkillsByCategory.ts rename to actions/organizeSkillsByCategory.ts diff --git a/actions/projects/getDescriptionBySlug.ts b/actions/projects/getDescriptionBySlug.ts deleted file mode 100644 index 330d8682..00000000 --- a/actions/projects/getDescriptionBySlug.ts +++ /dev/null @@ -1,18 +0,0 @@ -import Project from "@/types/projects"; - -/** - * Gets the description of the project for a given slug (unique identifier). - * If no project with the given slug exists in the given list of projects, undefined is returned. - * @param slug (string): The slug of the project to get the description of - * @param projects (Project[]): The list of projects to search through - * @returns (string | undefined): The description of the project with the given slug, or undefined if no project with that slug exists in the given list of projects - */ -function getDescriptionBySlug( - slug: string, - projects: Project[] -): string | undefined { - const project = projects.find((project) => project.slug === slug); - return project?.description; -} - -export default getDescriptionBySlug; diff --git a/actions/projects/getImagesListBySlug.ts b/actions/projects/getImagesListBySlug.ts deleted file mode 100644 index 62639878..00000000 --- a/actions/projects/getImagesListBySlug.ts +++ /dev/null @@ -1,19 +0,0 @@ -import Project from "@/types/projects"; - -/** - * Gets the list of images (paths to images) for the project with the given slug. - * If no project with the given slug exists in the given list of projects, undefined is returned. - * These paths are used to render the images in the project's page. - * @param slug (string): The slug of the project to get the images list from. - * @param projects (Project[]): The list of projects to search through. - * @returns (string[] | undefined): The list of images for the project with the given slug, or undefined if no project with that slug exists in the given list of projects. - */ -function getImagesListBySlug( - slug: string, - projects: Project[] -): string[] | undefined { - const project = projects.find((project) => project.slug === slug); - return project?.imagesList; -} - -export default getImagesListBySlug; diff --git a/actions/projects/getLanguageBySlug.ts b/actions/projects/getLanguageBySlug.ts deleted file mode 100644 index 3fc13ae8..00000000 --- a/actions/projects/getLanguageBySlug.ts +++ /dev/null @@ -1,18 +0,0 @@ -import Project from "@/types/projects"; - -/** - * Gets the language of the project for a given slug (unique identifier). - * If no project with the given slug exists in the given list of projects, undefined is returned. - * @param slug (string): The slug of the project to get the language of - * @param projects (Project[]): The list of projects to search through - * @returns (string | undefined): The language of the project with the given slug, or undefined if no project with that slug exists in the given list of projects - */ -function getLanguageBySlug( - slug: string, - projects: Project[] -): string | undefined { - const project = projects.find((project) => project.slug === slug); - return project?.programmingLanguage; -} - -export default getLanguageBySlug; diff --git a/actions/projects/getNameBySlug.ts b/actions/projects/getNameBySlug.ts deleted file mode 100644 index ddd3fa0e..00000000 --- a/actions/projects/getNameBySlug.ts +++ /dev/null @@ -1,15 +0,0 @@ -import Project from "@/types/projects"; - -/** - * Gets the name of a project for a given slug (unique identifier). - * If no project with the given slug exists in the given list of projects, undefined is returned. - * @param slug (string): The slug of the project to get the name of - * @param projects (Project[]): The list of projects to search through - * @returns (string | undefined): The name of the project with the given slug, or undefined if no project with that slug exists in the given list of projects - */ -function getNameBySlug(slug: string, projects: Project[]): string | undefined { - const project = projects.find((project) => project.slug === slug); - return project?.name; -} - -export default getNameBySlug; diff --git a/actions/projects/getRepoBySlug.ts b/actions/projects/getRepoBySlug.ts deleted file mode 100644 index b2016ba8..00000000 --- a/actions/projects/getRepoBySlug.ts +++ /dev/null @@ -1,15 +0,0 @@ -import Project from "@/types/projects"; - -/** - * Gets the repository URL of a project for a given slug (unique identifier). - * If no project with the given slug exists in the given list of projects, undefined is returned. - * @param slug (string): The slug of the project to get the repo of - * @param projects (Project[]): The list of projects to search through (usually the list of projects in the Vuex store - * @returns (string | undefined): The repo of the project with the given slug, or undefined if no project with that slug exists in the given list of projects - */ -function getRepoBySlug(slug: string, projects: Project[]): string | undefined { - const project = projects.find((project) => project.slug === slug); - return project?.repoURL; -} - -export default getRepoBySlug; diff --git a/actions/projects/getTechnologiesBySlug.ts b/actions/projects/getTechnologiesBySlug.ts deleted file mode 100644 index 0f0ccc41..00000000 --- a/actions/projects/getTechnologiesBySlug.ts +++ /dev/null @@ -1,18 +0,0 @@ -import Project from "@/types/projects"; - -/** - * Gets the list of technologies used in the project with the given slug (unique identifier). - * If no project with the given slug exists in the given list of projects, undefined is returned. - * @param slug (string): The slug of the project for which to get the technologies list - * @param projects (Project[]): The list of projects to search through (usually the list of projects in the Vuex store - * @returns (string[] | undefined): The list of technologies used in the project with the given slug, or undefined if no project with that slug exists in the given list of projects - */ -function getTechnologiesBySlug( - slug: string, - projects: Project[] -): string[] | undefined { - const project = projects.find((project) => project.slug === slug); - return project?.technologies; -} - -export default getTechnologiesBySlug; diff --git a/app/projects/[slug]/page.tsx b/app/projects/[slug]/page.tsx index f5cebbb1..96310be6 100644 --- a/app/projects/[slug]/page.tsx +++ b/app/projects/[slug]/page.tsx @@ -1,9 +1,4 @@ -import getDescriptionBySlug from "@/actions/projects/getDescriptionBySlug"; -import getImagesListBySlug from "@/actions/projects/getImagesListBySlug"; -import getLanguageBySlug from "@/actions/projects/getLanguageBySlug"; -import getNameBySlug from "@/actions/projects/getNameBySlug"; -import getProjectBySlug from "@/actions/projects/getProjectBySlug"; -import getTechnologiesBySlug from "@/actions/projects/getTechnologiesBySlug"; +import getProjectBySlug from "@/actions/getProjectBySlug"; import Tag from "@/components/Atoms/Tag"; import HeadingThree from "@/components/Content/Text/HeadingThree"; import HeadingTwo from "@/components/Content/Text/HeadingTwo"; @@ -69,12 +64,12 @@ const ProjectPage: React.FC = ({ params }) => { ]; const project = getProjectBySlug(slug, allProjects); - const projectName = getNameBySlug(slug, allProjects); - const projectTechnologies = getTechnologiesBySlug(slug, allProjects); - const projectLanguage = getLanguageBySlug(slug, allProjects); - const projectDescription = getDescriptionBySlug(slug, allProjects); + const projectName = project?.name; + const projectTechnologies = project?.technologies; + const projectLanguage = project?.programmingLanguage; + const projectDescription = project?.description; - let gallery = getImagesListBySlug(slug, allProjects); + let gallery = project?.imagesList; // Adds full path to images if (gallery) { gallery = gallery.map((image) => `/projects/${slug}/${image}`); diff --git a/components/Modal/LanguageModal.tsx b/components/Modal/LanguageModal.tsx index 8953672e..03453794 100644 --- a/components/Modal/LanguageModal.tsx +++ b/components/Modal/LanguageModal.tsx @@ -5,7 +5,7 @@ import Tag from "../Atoms/Tag"; import HeadingThree from "../Content/Text/HeadingThree"; import Dropdown from "../DropDown/DropDownMenu"; import Modal from "./Modal"; -import organizeSkillsByCategory from "@/actions/organize/organizeSkillsByCategory"; +import organizeSkillsByCategory from "@/actions/organizeSkillsByCategory"; interface ProjectModalProps { isOpen?: boolean; // whether the modal is open or not