From 48d5a24a087727900d8789849410af5ed41487fa Mon Sep 17 00:00:00 2001 From: Shawky Ebrahim Ahmed <101745968+shawkyebrahim2514@users.noreply.github.com> Date: Sat, 10 Feb 2024 18:57:22 +0200 Subject: [PATCH 1/4] Updating Sanity V2 ## I have updated the way that the data will be shown on the frontend - Made a portfolio document that holds all things including the logo text and pages content to manage it easily from the Sanity studio - This will separate handling many logics from the frontend to be done in the Sanity studio --- sanity-backend/package-lock.json | 9 +++ sanity-backend/package.json | 1 + sanity-backend/schemas/certificates.ts | 3 + sanity-backend/schemas/collegeCourses.ts | 3 + sanity-backend/schemas/contacts.ts | 3 + sanity-backend/schemas/index.ts | 6 +- sanity-backend/schemas/internships.ts | 3 + .../schemas/portfolio-pages/about.ts | 72 +++++++++++++++++ .../schemas/portfolio-pages/commanFields.ts | 27 +++++++ .../schemas/portfolio-pages/contacts.ts | 30 +++++++ .../schemas/portfolio-pages/education.ts | 80 +++++++++++++++++++ .../schemas/portfolio-pages/experience.ts | 64 +++++++++++++++ .../schemas/portfolio-pages/index.ts | 6 ++ .../schemas/portfolio-pages/projects.ts | 30 +++++++ .../schemas/portfolio-pages/skills.ts | 52 ++++++++++++ sanity-backend/schemas/portfolio.ts | 39 +++++++++ sanity-backend/schemas/projects.ts | 3 + sanity-backend/schemas/skills.ts | 3 + sanity-backend/schemas/skillsCategories.ts | 3 + sanity-backend/schemas/utilities.ts | 13 +++ 20 files changed, 449 insertions(+), 1 deletion(-) create mode 100644 sanity-backend/schemas/portfolio-pages/about.ts create mode 100644 sanity-backend/schemas/portfolio-pages/commanFields.ts create mode 100644 sanity-backend/schemas/portfolio-pages/contacts.ts create mode 100644 sanity-backend/schemas/portfolio-pages/education.ts create mode 100644 sanity-backend/schemas/portfolio-pages/experience.ts create mode 100644 sanity-backend/schemas/portfolio-pages/index.ts create mode 100644 sanity-backend/schemas/portfolio-pages/projects.ts create mode 100644 sanity-backend/schemas/portfolio-pages/skills.ts create mode 100644 sanity-backend/schemas/portfolio.ts create mode 100644 sanity-backend/schemas/utilities.ts diff --git a/sanity-backend/package-lock.json b/sanity-backend/package-lock.json index 57383cc..1c539a2 100644 --- a/sanity-backend/package-lock.json +++ b/sanity-backend/package-lock.json @@ -14,6 +14,7 @@ "@sanity/vision": "^3.19.1", "react": "^18.2.0", "react-dom": "^18.2.0", + "react-icons": "^5.0.1", "react-is": "^18.2.0", "sanity": "^3.19.1", "styled-components": "^6.0.7" @@ -8338,6 +8339,14 @@ } } }, + "node_modules/react-icons": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/react-icons/-/react-icons-5.0.1.tgz", + "integrity": "sha512-WqLZJ4bLzlhmsvme6iFdgO8gfZP17rfjYEJ2m9RsZjZ+cc4k1hTzknEz63YS1MeT50kVzoa1Nz36f4BEx+Wigw==", + "peerDependencies": { + "react": "*" + } + }, "node_modules/react-is": { "version": "18.2.0", "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", diff --git a/sanity-backend/package.json b/sanity-backend/package.json index 6ee1a16..ee2c7c3 100644 --- a/sanity-backend/package.json +++ b/sanity-backend/package.json @@ -20,6 +20,7 @@ "@sanity/vision": "^3.19.1", "react": "^18.2.0", "react-dom": "^18.2.0", + "react-icons": "^5.0.1", "react-is": "^18.2.0", "sanity": "^3.19.1", "styled-components": "^6.0.7" diff --git a/sanity-backend/schemas/certificates.ts b/sanity-backend/schemas/certificates.ts index a042d22..3bd327d 100644 --- a/sanity-backend/schemas/certificates.ts +++ b/sanity-backend/schemas/certificates.ts @@ -1,7 +1,10 @@ +import { PiCertificate } from "react-icons/pi"; + export const certificates = { name: 'certificates', type: 'document', title: 'Certificates', + icon: PiCertificate, fields: [ { name: 'title', diff --git a/sanity-backend/schemas/collegeCourses.ts b/sanity-backend/schemas/collegeCourses.ts index a89562b..5dbe943 100644 --- a/sanity-backend/schemas/collegeCourses.ts +++ b/sanity-backend/schemas/collegeCourses.ts @@ -1,7 +1,10 @@ +import { PiStudentFill } from "react-icons/pi"; + export const collegeCourses = { name: 'collegeCourses', type: 'document', title: 'College Courses', + icon: PiStudentFill, fields: [ { name: 'name', diff --git a/sanity-backend/schemas/contacts.ts b/sanity-backend/schemas/contacts.ts index 3c7ded2..2be3200 100644 --- a/sanity-backend/schemas/contacts.ts +++ b/sanity-backend/schemas/contacts.ts @@ -1,7 +1,10 @@ +import { MdContacts } from "react-icons/md"; + export const contacts = { name: 'contacts', type: 'document', title: 'Contacts', + icon: MdContacts, fields: [ { name: 'name', diff --git a/sanity-backend/schemas/index.ts b/sanity-backend/schemas/index.ts index d9c198c..0a878a1 100644 --- a/sanity-backend/schemas/index.ts +++ b/sanity-backend/schemas/index.ts @@ -1,3 +1,5 @@ +// Get react-icons from https://react-icons.github.io/react-icons/#/ + import { skillsCategories } from './skillsCategories' import { skills } from './skills' import { collegeCourses } from './collegeCourses' @@ -5,13 +7,15 @@ import { internships } from './internships' import { projects } from './projects' import { contacts } from './contacts' import { certificates } from './certificates' +import { portfolio } from './portfolio' export const schemaTypes = [ + portfolio, skillsCategories, skills, collegeCourses, internships, projects, + certificates, contacts, - certificates ] diff --git a/sanity-backend/schemas/internships.ts b/sanity-backend/schemas/internships.ts index 06b83e4..8a8cd54 100644 --- a/sanity-backend/schemas/internships.ts +++ b/sanity-backend/schemas/internships.ts @@ -1,7 +1,10 @@ +import { MdFactory } from "react-icons/md"; + export const internships = { name: 'internships', type: 'document', title: 'Internships', + icon: MdFactory, fields: [ { name: 'title', diff --git a/sanity-backend/schemas/portfolio-pages/about.ts b/sanity-backend/schemas/portfolio-pages/about.ts new file mode 100644 index 0000000..da087e9 --- /dev/null +++ b/sanity-backend/schemas/portfolio-pages/about.ts @@ -0,0 +1,72 @@ +import { commanPageName } from "./commanFields"; +import { FaCircleInfo } from "react-icons/fa6"; + +export const aboutPage = { + name: 'aboutPage', + type: 'document', + title: 'About Page', + icon: FaCircleInfo, + fields: [ + commanPageName, + { + name: 'personImage', + title: 'Person Image', + type: 'url', + validation: Rule => Rule.uri({ + scheme: ['http', 'https'] + }).required() + }, + { + name: 'salutation', + type: 'string', + title: 'Salutation', + validation: Rule => Rule.required() + }, + { + name: 'personName', + type: 'string', + title: 'Person Name', + validation: Rule => Rule.required() + }, + { + name: 'seeking', + type: 'string', + title: 'Seeking', + validation: Rule => Rule.required() + }, + { + name: 'position', + type: 'string', + title: 'Position', + validation: Rule => Rule.required() + }, + { + name: 'description', + type: 'text', + title: 'Description', + validation: Rule => Rule.required() + }, + { + name: 'resume', + type: 'object', + title: 'Resume', + fields: [ + { + name: 'text', + type: 'string', + title: 'Resume Text', + validation: Rule => Rule.required() + }, + { + name: 'link', + type: 'url', + title: 'Resume Link', + validation: Rule => Rule.uri({ + scheme: ['http', 'https'] + }).required() + }, + ], + validation: Rule => Rule.required() + } + ] +} \ No newline at end of file diff --git a/sanity-backend/schemas/portfolio-pages/commanFields.ts b/sanity-backend/schemas/portfolio-pages/commanFields.ts new file mode 100644 index 0000000..2d84415 --- /dev/null +++ b/sanity-backend/schemas/portfolio-pages/commanFields.ts @@ -0,0 +1,27 @@ +export const commanTitle = { + name: 'title', + type: 'object', + title: 'Title', + fields: [ + { + name: 'highlightedText', + type: 'string', + title: 'Highlighted Text', + validation: Rule => Rule.required() + }, + { + name: 'subText', + type: 'string', + title: 'Sub Text', + validation: Rule => Rule.required() + } + ], + validation: Rule => Rule.required() +} + +export const commanPageName = { + name: 'name', + type: 'string', + title: 'Page Name', + validation: Rule => Rule.required() +} \ No newline at end of file diff --git a/sanity-backend/schemas/portfolio-pages/contacts.ts b/sanity-backend/schemas/portfolio-pages/contacts.ts new file mode 100644 index 0000000..6d06bd2 --- /dev/null +++ b/sanity-backend/schemas/portfolio-pages/contacts.ts @@ -0,0 +1,30 @@ +import { commanTitle, commanPageName } from "./commanFields"; +import { MdContacts } from "react-icons/md"; + +export const contactsPage = { + name: 'contactsPage', + type: 'document', + title: 'Contacts Page', + icon: MdContacts, + fields: [ + commanPageName, + commanTitle, + { + name: 'contacts', + type: 'array', + title: 'Contacts', + validation: Rule => Rule.unique().required(), + of: [ + { + type: 'reference', + name: 'contact', + to: [ + { + type: 'contacts' + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/sanity-backend/schemas/portfolio-pages/education.ts b/sanity-backend/schemas/portfolio-pages/education.ts new file mode 100644 index 0000000..0e1ef1b --- /dev/null +++ b/sanity-backend/schemas/portfolio-pages/education.ts @@ -0,0 +1,80 @@ +import { commanTitle, commanPageName } from "./commanFields"; +import { PiStudentFill } from "react-icons/pi"; + +export const educationPage = { + name: 'educationPage', + type: 'document', + title: 'Education Page', + icon: PiStudentFill, + fields: [ + commanPageName, + commanTitle, + { + name: 'education', + type: 'object', + title: 'Education', + fields: [ + { + name: 'name', + type: 'string', + title: 'Name', + validation: Rule => Rule.required() + }, + { + name: 'description', + type: 'text', + title: 'Description', + validation: Rule => Rule.required() + }, + { + name: 'date', + type: 'object', + title: 'Date', + fields: [ + { + name: 'start', + type: 'date', + title: 'Start Date', + options: { + dateFormat: 'MM-YYYY' + }, + validation: Rule => Rule.required() + }, + { + name: 'end', + type: 'date', + title: 'End Date', + options: { + dateFormat: 'MM-YYYY' + }, + validation: Rule => Rule.required() + } + ] + }, + { + name: 'location', + type: 'string', + title: 'Location', + validation: Rule => Rule.required() + }, + { + name: 'courses', + type: 'array', + title: 'Courses', + validation: Rule => Rule.unique().required(), + of: [ + { + type: 'reference', + name: 'course', + to: [ + { + type: 'collegeCourses' + } + ] + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/sanity-backend/schemas/portfolio-pages/experience.ts b/sanity-backend/schemas/portfolio-pages/experience.ts new file mode 100644 index 0000000..dc9aa23 --- /dev/null +++ b/sanity-backend/schemas/portfolio-pages/experience.ts @@ -0,0 +1,64 @@ +import { commanTitle, commanPageName } from "./commanFields"; +import { GoGoal } from "react-icons/go"; + +export const experiencePage = { + name: 'experiencePage', + type: 'document', + title: 'Experience Page', + icon: GoGoal, + fields: [ + commanPageName, + { + name: 'internshipsSection', + type: 'object', + title: 'Internships Section', + validation: Rule => Rule.required(), + fields: [ + commanTitle, + { + name: 'internships', + type: 'array', + title: 'Internships', + validation: Rule => Rule.unique().required(), + of: [ + { + type: 'reference', + name: 'internship', + to: [ + { + type: 'internships' + } + ] + } + ] + } + ] + }, + { + name: 'certificatesSection', + type: 'object', + title: 'Certificates Section', + validation: Rule => Rule.required(), + fields: [ + commanTitle, + { + name: 'certificates', + type: 'array', + title: 'Certificates', + validation: Rule => Rule.unique().required(), + of: [ + { + type: 'reference', + name: 'certificate', + to: [ + { + type: 'certificates' + } + ] + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/sanity-backend/schemas/portfolio-pages/index.ts b/sanity-backend/schemas/portfolio-pages/index.ts new file mode 100644 index 0000000..7cfb7b9 --- /dev/null +++ b/sanity-backend/schemas/portfolio-pages/index.ts @@ -0,0 +1,6 @@ +export { aboutPage } from './about' +export { skillsPage } from './skills' +export { educationPage } from './education' +export { experiencePage } from './experience' +export { projectsPage } from './projects' +export { contactsPage } from './contacts' \ No newline at end of file diff --git a/sanity-backend/schemas/portfolio-pages/projects.ts b/sanity-backend/schemas/portfolio-pages/projects.ts new file mode 100644 index 0000000..7b9a0c7 --- /dev/null +++ b/sanity-backend/schemas/portfolio-pages/projects.ts @@ -0,0 +1,30 @@ +import { commanTitle, commanPageName } from "./commanFields"; +import { BiGitRepoForked } from "react-icons/bi"; + +export const projectsPage = { + name: 'projectsPage', + type: 'document', + title: 'Projects Page', + icon: BiGitRepoForked, + fields: [ + commanPageName, + commanTitle, + { + name: 'projects', + type: 'array', + title: 'Projects', + validation: Rule => Rule.unique().required(), + of: [ + { + type: 'reference', + name: 'project', + to: [ + { + type: 'projects' + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/sanity-backend/schemas/portfolio-pages/skills.ts b/sanity-backend/schemas/portfolio-pages/skills.ts new file mode 100644 index 0000000..5561ced --- /dev/null +++ b/sanity-backend/schemas/portfolio-pages/skills.ts @@ -0,0 +1,52 @@ +import { commanTitle, commanPageName } from "./commanFields"; +import { IoCodeSlash } from "react-icons/io5"; + +export const skillsPage = { + name: 'skillsPage', + type: 'document', + title: 'Skills Page', + icon: IoCodeSlash, + fields: [ + commanPageName, + commanTitle, + { + name: 'categories', + type: 'array', + title: 'Categories', + of: [ + { + type: 'object', + name: 'category', + title: 'Category', + fields: [ + { + name: 'title', + type: 'string', + title: 'Title', + validation: Rule => Rule.required() + }, + { + name: 'skills', + type: 'array', + title: 'Skills', + validation: Rule => Rule.unique().required(), + of: [ + { + type: 'reference', + title: 'Skill', + name: 'skill', + to: [ + { + type: 'skills' + } + ], + validation: Rule => Rule.required() + } + ] + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/sanity-backend/schemas/portfolio.ts b/sanity-backend/schemas/portfolio.ts new file mode 100644 index 0000000..d9a28db --- /dev/null +++ b/sanity-backend/schemas/portfolio.ts @@ -0,0 +1,39 @@ +import { TbWorldCode } from "react-icons/tb"; +import { + aboutPage, + skillsPage, + educationPage, + experiencePage, + projectsPage, + contactsPage +} from "./portfolio-pages"; +import { portfolioPagesRestrition } from "./utilities"; + +export const portfolio = { + name: 'portfolio', + type: 'document', + title: 'Portfolio', + icon: TbWorldCode, + fields: [ + { + name: 'title', + type: 'string', + title: 'Portfolio Title', + validation: Rule => Rule.required() + }, + { + name: "pages", + type: "array", + title: "Pages", + validation: Rule => Rule.custom(portfolioPagesRestrition), + of: [ + aboutPage, + skillsPage, + educationPage, + experiencePage, + projectsPage, + contactsPage + ] + } + ] +} \ No newline at end of file diff --git a/sanity-backend/schemas/projects.ts b/sanity-backend/schemas/projects.ts index e23904c..8596558 100644 --- a/sanity-backend/schemas/projects.ts +++ b/sanity-backend/schemas/projects.ts @@ -1,7 +1,10 @@ +import { BiGitRepoForked } from "react-icons/bi"; + export const projects = { name: 'projects', type: 'document', title: 'Projects', + icon: BiGitRepoForked, fields: [ { name: 'name', diff --git a/sanity-backend/schemas/skills.ts b/sanity-backend/schemas/skills.ts index 1410c73..a1b89ad 100644 --- a/sanity-backend/schemas/skills.ts +++ b/sanity-backend/schemas/skills.ts @@ -1,7 +1,10 @@ +import { IoCodeSlash } from "react-icons/io5"; + export const skills = { name: 'skills', type: 'document', title: 'Skills', + icon: IoCodeSlash, fields: [ { name: 'name', diff --git a/sanity-backend/schemas/skillsCategories.ts b/sanity-backend/schemas/skillsCategories.ts index 79f9d77..3b7b0f9 100644 --- a/sanity-backend/schemas/skillsCategories.ts +++ b/sanity-backend/schemas/skillsCategories.ts @@ -1,7 +1,10 @@ +import { TbFolderCode } from "react-icons/tb"; + export const skillsCategories = { name: 'skillsCategories', type: 'document', title: 'Skills Categories', + icon: TbFolderCode, fields: [ { name: 'name', diff --git a/sanity-backend/schemas/utilities.ts b/sanity-backend/schemas/utilities.ts new file mode 100644 index 0000000..957b734 --- /dev/null +++ b/sanity-backend/schemas/utilities.ts @@ -0,0 +1,13 @@ +const portfolioPagesRestrition = pages => { + if (pages.length !== 6) { + return 'You must have 6 pages'; + } + const pageNames = pages.map(page => page._type); + const uniquePageNames = [...new Set(pageNames)]; + if (uniquePageNames.length !== 6) { + return 'Each page must be unique'; + } + return true; +} + +export { portfolioPagesRestrition }; \ No newline at end of file From 67e0d3aadde8b753e05229802e56cc04600688f3 Mon Sep 17 00:00:00 2001 From: Shawky Ebrahim Ahmed <101745968+shawkyebrahim2514@users.noreply.github.com> Date: Sat, 10 Feb 2024 20:41:53 +0200 Subject: [PATCH 2/4] Made pages' records a static text --- sanity-backend/schemas/portfolio-pages/about.ts | 4 ++-- .../schemas/portfolio-pages/commanFields.ts | 15 ++++++++++----- .../schemas/portfolio-pages/contacts.ts | 4 ++-- .../schemas/portfolio-pages/education.ts | 4 ++-- .../schemas/portfolio-pages/experience.ts | 4 ++-- .../schemas/portfolio-pages/projects.ts | 4 ++-- sanity-backend/schemas/portfolio-pages/skills.ts | 4 ++-- sanity-backend/schemas/portfolio.ts | 4 ++-- 8 files changed, 24 insertions(+), 19 deletions(-) diff --git a/sanity-backend/schemas/portfolio-pages/about.ts b/sanity-backend/schemas/portfolio-pages/about.ts index da087e9..27ace62 100644 --- a/sanity-backend/schemas/portfolio-pages/about.ts +++ b/sanity-backend/schemas/portfolio-pages/about.ts @@ -1,4 +1,4 @@ -import { commanPageName } from "./commanFields"; +import { changeDocumentPreviewTitle } from "./commanFields"; import { FaCircleInfo } from "react-icons/fa6"; export const aboutPage = { @@ -6,8 +6,8 @@ export const aboutPage = { type: 'document', title: 'About Page', icon: FaCircleInfo, + ...changeDocumentPreviewTitle("About Page"), fields: [ - commanPageName, { name: 'personImage', title: 'Person Image', diff --git a/sanity-backend/schemas/portfolio-pages/commanFields.ts b/sanity-backend/schemas/portfolio-pages/commanFields.ts index 2d84415..a264dc8 100644 --- a/sanity-backend/schemas/portfolio-pages/commanFields.ts +++ b/sanity-backend/schemas/portfolio-pages/commanFields.ts @@ -19,9 +19,14 @@ export const commanTitle = { validation: Rule => Rule.required() } -export const commanPageName = { - name: 'name', - type: 'string', - title: 'Page Name', - validation: Rule => Rule.required() +export const changeDocumentPreviewTitle = (title: string) => { + return { + preview: { + prepare() { + return { + title: title, + } + } + }, + } } \ No newline at end of file diff --git a/sanity-backend/schemas/portfolio-pages/contacts.ts b/sanity-backend/schemas/portfolio-pages/contacts.ts index 6d06bd2..9201c9b 100644 --- a/sanity-backend/schemas/portfolio-pages/contacts.ts +++ b/sanity-backend/schemas/portfolio-pages/contacts.ts @@ -1,4 +1,4 @@ -import { commanTitle, commanPageName } from "./commanFields"; +import { commanTitle, changeDocumentPreviewTitle } from "./commanFields"; import { MdContacts } from "react-icons/md"; export const contactsPage = { @@ -6,8 +6,8 @@ export const contactsPage = { type: 'document', title: 'Contacts Page', icon: MdContacts, + ...changeDocumentPreviewTitle("Contacts Page"), fields: [ - commanPageName, commanTitle, { name: 'contacts', diff --git a/sanity-backend/schemas/portfolio-pages/education.ts b/sanity-backend/schemas/portfolio-pages/education.ts index 0e1ef1b..49ecd90 100644 --- a/sanity-backend/schemas/portfolio-pages/education.ts +++ b/sanity-backend/schemas/portfolio-pages/education.ts @@ -1,4 +1,4 @@ -import { commanTitle, commanPageName } from "./commanFields"; +import { commanTitle, changeDocumentPreviewTitle } from "./commanFields"; import { PiStudentFill } from "react-icons/pi"; export const educationPage = { @@ -6,8 +6,8 @@ export const educationPage = { type: 'document', title: 'Education Page', icon: PiStudentFill, + ...changeDocumentPreviewTitle("Education Page"), fields: [ - commanPageName, commanTitle, { name: 'education', diff --git a/sanity-backend/schemas/portfolio-pages/experience.ts b/sanity-backend/schemas/portfolio-pages/experience.ts index dc9aa23..5743d69 100644 --- a/sanity-backend/schemas/portfolio-pages/experience.ts +++ b/sanity-backend/schemas/portfolio-pages/experience.ts @@ -1,4 +1,4 @@ -import { commanTitle, commanPageName } from "./commanFields"; +import { commanTitle, changeDocumentPreviewTitle } from "./commanFields"; import { GoGoal } from "react-icons/go"; export const experiencePage = { @@ -6,8 +6,8 @@ export const experiencePage = { type: 'document', title: 'Experience Page', icon: GoGoal, + ...changeDocumentPreviewTitle("Experience Page"), fields: [ - commanPageName, { name: 'internshipsSection', type: 'object', diff --git a/sanity-backend/schemas/portfolio-pages/projects.ts b/sanity-backend/schemas/portfolio-pages/projects.ts index 7b9a0c7..038f158 100644 --- a/sanity-backend/schemas/portfolio-pages/projects.ts +++ b/sanity-backend/schemas/portfolio-pages/projects.ts @@ -1,4 +1,4 @@ -import { commanTitle, commanPageName } from "./commanFields"; +import { commanTitle, changeDocumentPreviewTitle } from "./commanFields"; import { BiGitRepoForked } from "react-icons/bi"; export const projectsPage = { @@ -6,8 +6,8 @@ export const projectsPage = { type: 'document', title: 'Projects Page', icon: BiGitRepoForked, + ...changeDocumentPreviewTitle("Projects Page"), fields: [ - commanPageName, commanTitle, { name: 'projects', diff --git a/sanity-backend/schemas/portfolio-pages/skills.ts b/sanity-backend/schemas/portfolio-pages/skills.ts index 5561ced..32ed7c8 100644 --- a/sanity-backend/schemas/portfolio-pages/skills.ts +++ b/sanity-backend/schemas/portfolio-pages/skills.ts @@ -1,4 +1,4 @@ -import { commanTitle, commanPageName } from "./commanFields"; +import { commanTitle, changeDocumentPreviewTitle } from "./commanFields"; import { IoCodeSlash } from "react-icons/io5"; export const skillsPage = { @@ -6,8 +6,8 @@ export const skillsPage = { type: 'document', title: 'Skills Page', icon: IoCodeSlash, + ...changeDocumentPreviewTitle("Skills Page"), fields: [ - commanPageName, commanTitle, { name: 'categories', diff --git a/sanity-backend/schemas/portfolio.ts b/sanity-backend/schemas/portfolio.ts index d9a28db..9258370 100644 --- a/sanity-backend/schemas/portfolio.ts +++ b/sanity-backend/schemas/portfolio.ts @@ -16,9 +16,9 @@ export const portfolio = { icon: TbWorldCode, fields: [ { - name: 'title', + name: 'logo', type: 'string', - title: 'Portfolio Title', + title: 'Logo', validation: Rule => Rule.required() }, { From ccae9b35bea1dfb708628574473b37290aab12ba Mon Sep 17 00:00:00 2001 From: Shawky Ebrahim Ahmed <101745968+shawkyebrahim2514@users.noreply.github.com> Date: Sun, 11 Feb 2024 21:28:52 +0200 Subject: [PATCH 3/4] Organize Sanity Files - Organized files to make it easy in modifications - Deleted rank fields from all documents - Deleted category field from skills document --- sanity-backend/schemas/index.ts | 14 +++--- .../schemas/portfolio-pages/index.ts | 6 --- sanity-backend/schemas/portfolio.ts | 39 --------------- .../{portfolio-pages => portfolio}/about.ts | 0 .../commanFields.ts | 0 .../contacts.ts | 0 .../education.ts | 0 .../experience.ts | 0 sanity-backend/schemas/portfolio/index.ts | 49 +++++++++++++++++++ .../projects.ts | 0 .../{portfolio-pages => portfolio}/skills.ts | 0 .../schemas/{ => portfolio}/utilities.ts | 0 sanity-backend/schemas/skills.ts | 34 ------------- sanity-backend/schemas/skillsCategories.ts | 16 ------ .../schemas/{ => units}/certificates.ts | 7 --- .../schemas/{ => units}/collegeCourses.ts | 7 --- .../schemas/{ => units}/contacts.ts | 0 .../schemas/{ => units}/internships.ts | 7 --- .../schemas/{ => units}/projects.ts | 7 --- sanity-backend/schemas/units/skills.ts | 20 ++++++++ 20 files changed, 75 insertions(+), 131 deletions(-) delete mode 100644 sanity-backend/schemas/portfolio-pages/index.ts delete mode 100644 sanity-backend/schemas/portfolio.ts rename sanity-backend/schemas/{portfolio-pages => portfolio}/about.ts (100%) rename sanity-backend/schemas/{portfolio-pages => portfolio}/commanFields.ts (100%) rename sanity-backend/schemas/{portfolio-pages => portfolio}/contacts.ts (100%) rename sanity-backend/schemas/{portfolio-pages => portfolio}/education.ts (100%) rename sanity-backend/schemas/{portfolio-pages => portfolio}/experience.ts (100%) create mode 100644 sanity-backend/schemas/portfolio/index.ts rename sanity-backend/schemas/{portfolio-pages => portfolio}/projects.ts (100%) rename sanity-backend/schemas/{portfolio-pages => portfolio}/skills.ts (100%) rename sanity-backend/schemas/{ => portfolio}/utilities.ts (100%) delete mode 100644 sanity-backend/schemas/skills.ts delete mode 100644 sanity-backend/schemas/skillsCategories.ts rename sanity-backend/schemas/{ => units}/certificates.ts (85%) rename sanity-backend/schemas/{ => units}/collegeCourses.ts (79%) rename sanity-backend/schemas/{ => units}/contacts.ts (100%) rename sanity-backend/schemas/{ => units}/internships.ts (90%) rename sanity-backend/schemas/{ => units}/projects.ts (89%) create mode 100644 sanity-backend/schemas/units/skills.ts diff --git a/sanity-backend/schemas/index.ts b/sanity-backend/schemas/index.ts index 0a878a1..d360134 100644 --- a/sanity-backend/schemas/index.ts +++ b/sanity-backend/schemas/index.ts @@ -1,17 +1,15 @@ // Get react-icons from https://react-icons.github.io/react-icons/#/ -import { skillsCategories } from './skillsCategories' -import { skills } from './skills' -import { collegeCourses } from './collegeCourses' -import { internships } from './internships' -import { projects } from './projects' -import { contacts } from './contacts' -import { certificates } from './certificates' +import { skills } from './units/skills' +import { collegeCourses } from './units/collegeCourses' +import { internships } from './units/internships' +import { projects } from './units/projects' +import { contacts } from './units/contacts' +import { certificates } from './units/certificates' import { portfolio } from './portfolio' export const schemaTypes = [ portfolio, - skillsCategories, skills, collegeCourses, internships, diff --git a/sanity-backend/schemas/portfolio-pages/index.ts b/sanity-backend/schemas/portfolio-pages/index.ts deleted file mode 100644 index 7cfb7b9..0000000 --- a/sanity-backend/schemas/portfolio-pages/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -export { aboutPage } from './about' -export { skillsPage } from './skills' -export { educationPage } from './education' -export { experiencePage } from './experience' -export { projectsPage } from './projects' -export { contactsPage } from './contacts' \ No newline at end of file diff --git a/sanity-backend/schemas/portfolio.ts b/sanity-backend/schemas/portfolio.ts deleted file mode 100644 index 9258370..0000000 --- a/sanity-backend/schemas/portfolio.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { TbWorldCode } from "react-icons/tb"; -import { - aboutPage, - skillsPage, - educationPage, - experiencePage, - projectsPage, - contactsPage -} from "./portfolio-pages"; -import { portfolioPagesRestrition } from "./utilities"; - -export const portfolio = { - name: 'portfolio', - type: 'document', - title: 'Portfolio', - icon: TbWorldCode, - fields: [ - { - name: 'logo', - type: 'string', - title: 'Logo', - validation: Rule => Rule.required() - }, - { - name: "pages", - type: "array", - title: "Pages", - validation: Rule => Rule.custom(portfolioPagesRestrition), - of: [ - aboutPage, - skillsPage, - educationPage, - experiencePage, - projectsPage, - contactsPage - ] - } - ] -} \ No newline at end of file diff --git a/sanity-backend/schemas/portfolio-pages/about.ts b/sanity-backend/schemas/portfolio/about.ts similarity index 100% rename from sanity-backend/schemas/portfolio-pages/about.ts rename to sanity-backend/schemas/portfolio/about.ts diff --git a/sanity-backend/schemas/portfolio-pages/commanFields.ts b/sanity-backend/schemas/portfolio/commanFields.ts similarity index 100% rename from sanity-backend/schemas/portfolio-pages/commanFields.ts rename to sanity-backend/schemas/portfolio/commanFields.ts diff --git a/sanity-backend/schemas/portfolio-pages/contacts.ts b/sanity-backend/schemas/portfolio/contacts.ts similarity index 100% rename from sanity-backend/schemas/portfolio-pages/contacts.ts rename to sanity-backend/schemas/portfolio/contacts.ts diff --git a/sanity-backend/schemas/portfolio-pages/education.ts b/sanity-backend/schemas/portfolio/education.ts similarity index 100% rename from sanity-backend/schemas/portfolio-pages/education.ts rename to sanity-backend/schemas/portfolio/education.ts diff --git a/sanity-backend/schemas/portfolio-pages/experience.ts b/sanity-backend/schemas/portfolio/experience.ts similarity index 100% rename from sanity-backend/schemas/portfolio-pages/experience.ts rename to sanity-backend/schemas/portfolio/experience.ts diff --git a/sanity-backend/schemas/portfolio/index.ts b/sanity-backend/schemas/portfolio/index.ts new file mode 100644 index 0000000..e06db66 --- /dev/null +++ b/sanity-backend/schemas/portfolio/index.ts @@ -0,0 +1,49 @@ +import { TbWorldCode } from "react-icons/tb"; +import { aboutPage } from "./about"; +import { skillsPage } from "./skills"; +import { educationPage } from "./education"; +import { experiencePage } from "./experience"; +import { projectsPage } from "./projects"; +import { contactsPage } from "./contacts"; +import { portfolioPagesRestrition } from "./utilities"; + +export const portfolio = { + name: 'portfolio', + type: 'document', + title: 'Portfolio', + icon: TbWorldCode, + preview: { + select: { + title: 'navbar.logo' + } + }, + fields: [ + { + name: 'navbar', + type: 'object', + title: 'Navbar', + fields: [ + { + name: 'logo', + type: 'string', + title: 'Logo', + validation: Rule => Rule.required() + }, + ] + }, + { + name: "pages", + type: "array", + title: "Pages", + validation: Rule => Rule.custom(portfolioPagesRestrition), + of: [ + aboutPage, + skillsPage, + educationPage, + experiencePage, + projectsPage, + contactsPage + ] + } + ] +} \ No newline at end of file diff --git a/sanity-backend/schemas/portfolio-pages/projects.ts b/sanity-backend/schemas/portfolio/projects.ts similarity index 100% rename from sanity-backend/schemas/portfolio-pages/projects.ts rename to sanity-backend/schemas/portfolio/projects.ts diff --git a/sanity-backend/schemas/portfolio-pages/skills.ts b/sanity-backend/schemas/portfolio/skills.ts similarity index 100% rename from sanity-backend/schemas/portfolio-pages/skills.ts rename to sanity-backend/schemas/portfolio/skills.ts diff --git a/sanity-backend/schemas/utilities.ts b/sanity-backend/schemas/portfolio/utilities.ts similarity index 100% rename from sanity-backend/schemas/utilities.ts rename to sanity-backend/schemas/portfolio/utilities.ts diff --git a/sanity-backend/schemas/skills.ts b/sanity-backend/schemas/skills.ts deleted file mode 100644 index a1b89ad..0000000 --- a/sanity-backend/schemas/skills.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { IoCodeSlash } from "react-icons/io5"; - -export const skills = { - name: 'skills', - type: 'document', - title: 'Skills', - icon: IoCodeSlash, - fields: [ - { - name: 'name', - type: 'string', - title: 'Name' - }, - { - name: 'rank', - type: 'number', - title: 'Rank', - initialValue: 0, - validation: Rule => Rule.required() - }, - { - name: 'category', - type: 'reference', - title: 'Category', - to: [{ type: 'skillsCategories' }], - validation: Rule => Rule.required() - }, - { - name: 'icon', - type: 'image', - title: 'Icon' - }, - ] -} \ No newline at end of file diff --git a/sanity-backend/schemas/skillsCategories.ts b/sanity-backend/schemas/skillsCategories.ts deleted file mode 100644 index 3b7b0f9..0000000 --- a/sanity-backend/schemas/skillsCategories.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { TbFolderCode } from "react-icons/tb"; - -export const skillsCategories = { - name: 'skillsCategories', - type: 'document', - title: 'Skills Categories', - icon: TbFolderCode, - fields: [ - { - name: 'name', - type: 'string', - title: 'Name', - validation: Rule => Rule.required() - }, - ] -} \ No newline at end of file diff --git a/sanity-backend/schemas/certificates.ts b/sanity-backend/schemas/units/certificates.ts similarity index 85% rename from sanity-backend/schemas/certificates.ts rename to sanity-backend/schemas/units/certificates.ts index 3bd327d..36af4f7 100644 --- a/sanity-backend/schemas/certificates.ts +++ b/sanity-backend/schemas/units/certificates.ts @@ -23,13 +23,6 @@ export const certificates = { type: 'text', title: 'Description', }, - { - name: 'rank', - type: 'number', - title: 'Rank', - initialValue: 0, - validation: Rule => Rule.required() - }, { name: 'date', type: 'date', diff --git a/sanity-backend/schemas/collegeCourses.ts b/sanity-backend/schemas/units/collegeCourses.ts similarity index 79% rename from sanity-backend/schemas/collegeCourses.ts rename to sanity-backend/schemas/units/collegeCourses.ts index 5dbe943..8bf2a03 100644 --- a/sanity-backend/schemas/collegeCourses.ts +++ b/sanity-backend/schemas/units/collegeCourses.ts @@ -12,13 +12,6 @@ export const collegeCourses = { title: 'Name', validation: Rule => Rule.required() }, - { - name: 'rank', - type: 'number', - title: 'Rank', - initialValue: 0, - validation: Rule => Rule.required() - }, { name: 'description', type: 'text', diff --git a/sanity-backend/schemas/contacts.ts b/sanity-backend/schemas/units/contacts.ts similarity index 100% rename from sanity-backend/schemas/contacts.ts rename to sanity-backend/schemas/units/contacts.ts diff --git a/sanity-backend/schemas/internships.ts b/sanity-backend/schemas/units/internships.ts similarity index 90% rename from sanity-backend/schemas/internships.ts rename to sanity-backend/schemas/units/internships.ts index 8a8cd54..326bade 100644 --- a/sanity-backend/schemas/internships.ts +++ b/sanity-backend/schemas/units/internships.ts @@ -18,13 +18,6 @@ export const internships = { title: 'Sub Title', validation: Rule => Rule.required() }, - { - name: 'rank', - type: 'number', - title: 'Rank', - initialValue: 0, - validation: Rule => Rule.required() - }, { name: 'date', type: 'object', diff --git a/sanity-backend/schemas/projects.ts b/sanity-backend/schemas/units/projects.ts similarity index 89% rename from sanity-backend/schemas/projects.ts rename to sanity-backend/schemas/units/projects.ts index 8596558..6f7ee3e 100644 --- a/sanity-backend/schemas/projects.ts +++ b/sanity-backend/schemas/units/projects.ts @@ -12,13 +12,6 @@ export const projects = { title: 'Name', validation: Rule => Rule.required() }, - { - name: 'rank', - type: 'number', - title: 'Rank', - initialValue: 0, - validation: Rule => Rule.required() - }, { name: 'links', type: 'object', diff --git a/sanity-backend/schemas/units/skills.ts b/sanity-backend/schemas/units/skills.ts new file mode 100644 index 0000000..9c2500f --- /dev/null +++ b/sanity-backend/schemas/units/skills.ts @@ -0,0 +1,20 @@ +import { IoCodeSlash } from "react-icons/io5"; + +export const skills = { + name: 'skills', + type: 'document', + title: 'Skills', + icon: IoCodeSlash, + fields: [ + { + name: 'name', + type: 'string', + title: 'Name' + }, + { + name: 'icon', + type: 'image', + title: 'Icon' + }, + ] +} \ No newline at end of file From b3535fafbc9fb79a00141dc3a81173c32673958f Mon Sep 17 00:00:00 2001 From: Shawky Ebrahim Ahmed <101745968+shawkyebrahim2514@users.noreply.github.com> Date: Sun, 11 Feb 2024 21:32:17 +0200 Subject: [PATCH 4/4] Updated the frontend to cope with the Sanity modifications - Organized APIs files - Make all the application to depend on the data that comes from Sanity instead of getting data from static files --- react-frontend/package-lock.json | 22 +++--- .../src/APIs/ExternalResource/index.ts | 5 -- react-frontend/src/APIs/Sanity/about.ts | 20 +++++ .../src/APIs/Sanity/certificates.ts | 19 ----- react-frontend/src/APIs/Sanity/client.ts | 3 +- react-frontend/src/APIs/Sanity/contacts.ts | 19 +++-- react-frontend/src/APIs/Sanity/education.ts | 25 +++++++ .../src/APIs/Sanity/educationCourses.ts | 17 ----- react-frontend/src/APIs/Sanity/experience.ts | 34 +++++++++ react-frontend/src/APIs/Sanity/index.ts | 13 ++-- react-frontend/src/APIs/Sanity/internships.ts | 20 ----- react-frontend/src/APIs/Sanity/navbar.ts | 12 +++ react-frontend/src/APIs/Sanity/projects.ts | 24 +++--- react-frontend/src/APIs/Sanity/skills.ts | 21 ++++-- react-frontend/src/APIs/index.ts | 15 ++-- react-frontend/src/Texts/about.ts | 9 --- react-frontend/src/Texts/contacts.ts | 4 - react-frontend/src/Texts/education.ts | 11 --- react-frontend/src/Texts/experience.ts | 10 --- react-frontend/src/Texts/index.ts | 13 ---- react-frontend/src/Texts/navbarContent.ts | 5 -- react-frontend/src/Texts/projects.ts | 4 - react-frontend/src/Texts/skills.ts | 4 - react-frontend/src/Types/index.ts | 27 +++---- react-frontend/src/Types/pages/contacts.ts | 1 - react-frontend/src/Types/pages/education.ts | 3 - react-frontend/src/Types/pages/experience.ts | 5 -- react-frontend/src/Types/pages/projects.ts | 3 - react-frontend/src/Types/pages/skills.ts | 3 - react-frontend/src/Types/sanity.ts | 55 -------------- react-frontend/src/Types/sanity/aboutPage.ts | 14 ++++ react-frontend/src/Types/sanity/common.ts | 6 ++ .../src/Types/sanity/contactsPage.ts | 11 +++ .../src/Types/sanity/educationPage.ts | 22 ++++++ .../src/Types/sanity/experiencePage.ts | 36 +++++++++ react-frontend/src/Types/sanity/index.ts | 8 ++ react-frontend/src/Types/sanity/navbarData.ts | 3 + .../src/Types/sanity/projectsPage.ts | 18 +++++ react-frontend/src/Types/sanity/skillsPage.ts | 15 ++++ react-frontend/src/components/Icon/index.tsx | 4 +- .../src/components/Loader/index.tsx | 1 - react-frontend/src/components/Navbar/Logo.tsx | 7 +- .../src/components/Navbar/index.tsx | 18 ++++- .../src/components/ProjectCard/index.tsx | 2 +- .../containers/About/Content/Description.tsx | 6 +- .../src/containers/About/Content/Name.tsx | 6 +- .../src/containers/About/Content/Position.tsx | 6 +- .../containers/About/Content/ResumeButton.tsx | 9 +-- .../containers/About/Content/Salutation.tsx | 6 +- .../About/Content/SeekingPhrase.tsx | 6 +- .../src/containers/About/Content/index.tsx | 22 ++++-- .../{GithubImage.tsx => ActualImage.tsx} | 6 +- .../src/containers/About/Image/index.tsx | 7 +- react-frontend/src/containers/About/index.tsx | 31 ++++++-- .../src/containers/Contacts/Content.tsx | 29 ++++++++ .../Contacts/ListContacts/ContactsItems.tsx | 27 ------- .../Contacts/ListContacts/index.tsx | 30 -------- .../src/containers/Contacts/index.tsx | 43 +++++------ .../CoursesItems.tsx | 8 +- .../Content/EducationInformation.tsx | 24 ++++++ .../containers/Education/Content/index.tsx | 28 +++++++ .../EducationInformation.tsx | 47 ------------ .../MainSectionContent/ListCourses.tsx | 40 ---------- .../Education/MainSectionContent/index.tsx | 19 ----- .../src/containers/Education/index.tsx | 42 +++++------ .../Experience/Certificates/Content.tsx | 35 +++++++++ .../SubtitleAndDate.tsx | 0 .../Experience/Certificates/index.tsx | 15 ++++ .../ExperienceItemDescription.tsx | 15 ++-- .../ExperienceItemInformation.tsx | 11 +-- .../Experience/Internships/Content.tsx | 41 +++++++++++ .../Experience/Internships/index.tsx | 15 ++++ .../ListCertificates/CertificatesItems.tsx | 38 ---------- .../ListCertificates/Description.tsx | 36 --------- .../Experience/ListCertificates/index.tsx | 43 ----------- .../ListInternships/ExperiencesItems.tsx | 40 ---------- .../Experience/ListInternships/index.tsx | 43 ----------- .../src/containers/Experience/index.tsx | 46 +++++------- .../ProjectsItems.tsx => Content.tsx} | 16 ++-- .../Projects/ListProjects/index.tsx | 45 ------------ .../src/containers/Projects/index.tsx | 31 +++++--- .../containers/Skills/Content/SkillsIcons.tsx | 17 +++++ .../Skills/Content/TechnologiesItems.tsx | 47 ------------ .../src/containers/Skills/Content/index.tsx | 73 ++++++++----------- .../containers/Skills/Content/listIcons.tsx | 21 ------ .../src/containers/Skills/index.tsx | 31 +++++--- react-frontend/src/containers/Title.tsx | 13 ++++ 87 files changed, 753 insertions(+), 952 deletions(-) delete mode 100644 react-frontend/src/APIs/ExternalResource/index.ts create mode 100644 react-frontend/src/APIs/Sanity/about.ts delete mode 100644 react-frontend/src/APIs/Sanity/certificates.ts create mode 100644 react-frontend/src/APIs/Sanity/education.ts delete mode 100644 react-frontend/src/APIs/Sanity/educationCourses.ts create mode 100644 react-frontend/src/APIs/Sanity/experience.ts delete mode 100644 react-frontend/src/APIs/Sanity/internships.ts create mode 100644 react-frontend/src/APIs/Sanity/navbar.ts delete mode 100644 react-frontend/src/Texts/about.ts delete mode 100644 react-frontend/src/Texts/contacts.ts delete mode 100644 react-frontend/src/Texts/education.ts delete mode 100644 react-frontend/src/Texts/experience.ts delete mode 100644 react-frontend/src/Texts/index.ts delete mode 100644 react-frontend/src/Texts/navbarContent.ts delete mode 100644 react-frontend/src/Texts/projects.ts delete mode 100644 react-frontend/src/Texts/skills.ts delete mode 100644 react-frontend/src/Types/pages/contacts.ts delete mode 100644 react-frontend/src/Types/pages/education.ts delete mode 100644 react-frontend/src/Types/pages/experience.ts delete mode 100644 react-frontend/src/Types/pages/projects.ts delete mode 100644 react-frontend/src/Types/pages/skills.ts delete mode 100644 react-frontend/src/Types/sanity.ts create mode 100644 react-frontend/src/Types/sanity/aboutPage.ts create mode 100644 react-frontend/src/Types/sanity/common.ts create mode 100644 react-frontend/src/Types/sanity/contactsPage.ts create mode 100644 react-frontend/src/Types/sanity/educationPage.ts create mode 100644 react-frontend/src/Types/sanity/experiencePage.ts create mode 100644 react-frontend/src/Types/sanity/index.ts create mode 100644 react-frontend/src/Types/sanity/navbarData.ts create mode 100644 react-frontend/src/Types/sanity/projectsPage.ts create mode 100644 react-frontend/src/Types/sanity/skillsPage.ts rename react-frontend/src/containers/About/Image/{GithubImage.tsx => ActualImage.tsx} (76%) create mode 100644 react-frontend/src/containers/Contacts/Content.tsx delete mode 100644 react-frontend/src/containers/Contacts/ListContacts/ContactsItems.tsx delete mode 100644 react-frontend/src/containers/Contacts/ListContacts/index.tsx rename react-frontend/src/containers/Education/{MainSectionContent => Content}/CoursesItems.tsx (90%) create mode 100644 react-frontend/src/containers/Education/Content/EducationInformation.tsx create mode 100644 react-frontend/src/containers/Education/Content/index.tsx delete mode 100644 react-frontend/src/containers/Education/MainSectionContent/EducationInformation.tsx delete mode 100644 react-frontend/src/containers/Education/MainSectionContent/ListCourses.tsx delete mode 100644 react-frontend/src/containers/Education/MainSectionContent/index.tsx create mode 100644 react-frontend/src/containers/Experience/Certificates/Content.tsx rename react-frontend/src/containers/Experience/{ListCertificates => Certificates}/SubtitleAndDate.tsx (100%) create mode 100644 react-frontend/src/containers/Experience/Certificates/index.tsx rename react-frontend/src/containers/Experience/{ListInternships => }/ExperienceItemDescription.tsx (52%) rename react-frontend/src/containers/Experience/{ListInternships => }/ExperienceItemInformation.tsx (70%) create mode 100644 react-frontend/src/containers/Experience/Internships/Content.tsx create mode 100644 react-frontend/src/containers/Experience/Internships/index.tsx delete mode 100644 react-frontend/src/containers/Experience/ListCertificates/CertificatesItems.tsx delete mode 100644 react-frontend/src/containers/Experience/ListCertificates/Description.tsx delete mode 100644 react-frontend/src/containers/Experience/ListCertificates/index.tsx delete mode 100644 react-frontend/src/containers/Experience/ListInternships/ExperiencesItems.tsx delete mode 100644 react-frontend/src/containers/Experience/ListInternships/index.tsx rename react-frontend/src/containers/Projects/{ListProjects/ProjectsItems.tsx => Content.tsx} (61%) delete mode 100644 react-frontend/src/containers/Projects/ListProjects/index.tsx create mode 100644 react-frontend/src/containers/Skills/Content/SkillsIcons.tsx delete mode 100644 react-frontend/src/containers/Skills/Content/TechnologiesItems.tsx delete mode 100644 react-frontend/src/containers/Skills/Content/listIcons.tsx create mode 100644 react-frontend/src/containers/Title.tsx diff --git a/react-frontend/package-lock.json b/react-frontend/package-lock.json index fc2f16a..5245980 100644 --- a/react-frontend/package-lock.json +++ b/react-frontend/package-lock.json @@ -3402,13 +3402,13 @@ "integrity": "sha512-2/U3GXA6YiPYQDLGwtGlnNgKYBSwCFIHf8Y9LUY5VATHdtbLlU0Y1R3QoBnT0aB4qv/BEiVVsj7LJXoQCgJ2vA==" }, "node_modules/@sanity/client": { - "version": "6.10.0", - "resolved": "https://registry.npmjs.org/@sanity/client/-/client-6.10.0.tgz", - "integrity": "sha512-TavtxGB6NWjro2BTGXSkzXNMKFZbS2il1ItV3IdRvO0luLqS31eIz37+5X4CmCC8hGFe6fDoCjnH/iJ81vKM7g==", + "version": "6.12.4", + "resolved": "https://registry.npmjs.org/@sanity/client/-/client-6.12.4.tgz", + "integrity": "sha512-eDBnKwKdFIiMeRZ5xPaKUOs+gsw6P4Bq+Bj7cZ9xuaLXMTsOSlB5h9TsPW5vAYRMbm4coVYUvhqm9TMwSi0F2Q==", "dependencies": { "@sanity/eventsource": "^5.0.0", "@vercel/stega": "0.1.0", - "get-it": "^8.4.4", + "get-it": "^8.4.6", "rxjs": "^7.0.0" }, "engines": { @@ -8285,9 +8285,9 @@ "integrity": "sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==" }, "node_modules/follow-redirects": { - "version": "1.15.3", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz", - "integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==", + "version": "1.15.5", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.5.tgz", + "integrity": "sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==", "funding": [ { "type": "individual", @@ -8672,13 +8672,13 @@ } }, "node_modules/get-it": { - "version": "8.4.4", - "resolved": "https://registry.npmjs.org/get-it/-/get-it-8.4.4.tgz", - "integrity": "sha512-Pu3pnJfnYuLEhwJgMlFqk19ugvtazzTxh7rg8wATaBL4c5Fy4ahM5B+bGdluiNSNYYK89F5vSa+N3sTa/qqtlg==", + "version": "8.4.6", + "resolved": "https://registry.npmjs.org/get-it/-/get-it-8.4.6.tgz", + "integrity": "sha512-omefjdbyRb2rRt0tnrZlbeWx9oZJm66o88K8JlYn13xELn+0+d6mJZOQHrJAdC3vxeJ4t/NHa4wh7Wlh+nvEJA==", "dependencies": { "debug": "^4.3.4", "decompress-response": "^7.0.0", - "follow-redirects": "^1.15.2", + "follow-redirects": "^1.15.4", "into-stream": "^6.0.0", "is-plain-object": "^5.0.0", "is-retry-allowed": "^2.2.0", diff --git a/react-frontend/src/APIs/ExternalResource/index.ts b/react-frontend/src/APIs/ExternalResource/index.ts deleted file mode 100644 index 7e4a32b..0000000 --- a/react-frontend/src/APIs/ExternalResource/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -const getGithubImageURL = (username: string) => `https://avatars.githubusercontent.com/${username}`; - -const getResumeURL = () => `https://drive.google.com/drive/folders/1yJmOWWaRQpM32haB8CeXCOzK0_WC6o59`; - -export { getGithubImageURL, getResumeURL }; diff --git a/react-frontend/src/APIs/Sanity/about.ts b/react-frontend/src/APIs/Sanity/about.ts new file mode 100644 index 0000000..a070d6f --- /dev/null +++ b/react-frontend/src/APIs/Sanity/about.ts @@ -0,0 +1,20 @@ +import { SanityAboutPage } from '../../Types'; +import sanityClient from './client'; + +const getAboutPage = async () => { + const query = `*[_type == "portfolio"][0].pages[_type == "aboutPage"][0] { + salutation, + personImage, + seeking, + personName, + description, + resume, + position + }`; + const result: SanityAboutPage = await sanityClient.fetch(query); + return result; +}; + +export { + getAboutPage, +} \ No newline at end of file diff --git a/react-frontend/src/APIs/Sanity/certificates.ts b/react-frontend/src/APIs/Sanity/certificates.ts deleted file mode 100644 index b8c5c02..0000000 --- a/react-frontend/src/APIs/Sanity/certificates.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { SanityCertificate } from '../../Types'; -import sanityClient from './client'; - -const getCertificates = async () => { - const query = `*[_type == "certificates"]{ - title, - subTitle, - rank, - description, - date, - link, - }`; - const result: SanityCertificate[] = await sanityClient.fetch(query); - return result; -}; - -export { - getCertificates, -} \ No newline at end of file diff --git a/react-frontend/src/APIs/Sanity/client.ts b/react-frontend/src/APIs/Sanity/client.ts index 9a663a4..b5896f8 100644 --- a/react-frontend/src/APIs/Sanity/client.ts +++ b/react-frontend/src/APIs/Sanity/client.ts @@ -3,7 +3,8 @@ import { createClient } from '@sanity/client' const sanityClient = createClient({ projectId: 'h48br789', dataset: 'production', - useCdn: true + useCdn: true, + apiVersion: '2022-03-07', }) export default sanityClient; \ No newline at end of file diff --git a/react-frontend/src/APIs/Sanity/contacts.ts b/react-frontend/src/APIs/Sanity/contacts.ts index ed32fbe..9e78951 100644 --- a/react-frontend/src/APIs/Sanity/contacts.ts +++ b/react-frontend/src/APIs/Sanity/contacts.ts @@ -1,16 +1,19 @@ -import { SanityContact } from '../../Types'; +import { SanityContactsPage } from '../../Types'; import sanityClient from './client'; -const getContacts = async () => { - const query = `*[_type == "contacts"]{ - "imgSrc": icon.asset->url, - link, - name +const getContactsPage = async () => { + const query = `*[_type == "portfolio"][0].pages[_type == "contactsPage"][0] { + title, + "contacts": contacts[] -> { + "imgSrc": icon.asset->url, + link, + name + } }`; - const result: SanityContact[] = await sanityClient.fetch(query); + const result: SanityContactsPage = await sanityClient.fetch(query); return result; }; export { - getContacts, + getContactsPage, } \ No newline at end of file diff --git a/react-frontend/src/APIs/Sanity/education.ts b/react-frontend/src/APIs/Sanity/education.ts new file mode 100644 index 0000000..797584d --- /dev/null +++ b/react-frontend/src/APIs/Sanity/education.ts @@ -0,0 +1,25 @@ +import { SanityEducationPage } from '../../Types'; +import sanityClient from './client'; + +const getEducationPage = async () => { + const query = `*[_type == "portfolio"][0].pages[_type == "educationPage"][0] { + title, + education { + name, + description, + location, + date, + courses[] -> { + name, + description, + "technologies": technologies[]->name + } + } + }`; + const result: SanityEducationPage = await sanityClient.fetch(query); + return result; +}; + +export { + getEducationPage, +} \ No newline at end of file diff --git a/react-frontend/src/APIs/Sanity/educationCourses.ts b/react-frontend/src/APIs/Sanity/educationCourses.ts deleted file mode 100644 index be09a46..0000000 --- a/react-frontend/src/APIs/Sanity/educationCourses.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { SanityEducationCourse } from '../../Types'; -import sanityClient from './client'; - -const getEducationCourses = async () => { - const query = `*[_type == "collegeCourses"]{ - name, - rank, - description, - "technologies": technologies[]->name - }`; - const result: SanityEducationCourse[] = await sanityClient.fetch(query); - return result; -}; - -export { - getEducationCourses, -} \ No newline at end of file diff --git a/react-frontend/src/APIs/Sanity/experience.ts b/react-frontend/src/APIs/Sanity/experience.ts new file mode 100644 index 0000000..e6c9c20 --- /dev/null +++ b/react-frontend/src/APIs/Sanity/experience.ts @@ -0,0 +1,34 @@ +import { SanityExperiencePage } from '../../Types'; +import sanityClient from './client'; + +const getExperiencePage = async () => { + const query = `*[_type == "portfolio"][0].pages[_type == "experiencePage"][0] { + internshipsSection { + title, + internships[] -> { + title, + subTitle, + date, + link, + description, + "technologies": technologies[]->name + } + }, + certificatesSection { + title, + certificates[] -> { + title, + subTitle, + description, + date, + link, + } + } + }`; + const result: SanityExperiencePage = await sanityClient.fetch(query); + return result; +}; + +export { + getExperiencePage, +} \ No newline at end of file diff --git a/react-frontend/src/APIs/Sanity/index.ts b/react-frontend/src/APIs/Sanity/index.ts index 7759ad4..4b1ad10 100644 --- a/react-frontend/src/APIs/Sanity/index.ts +++ b/react-frontend/src/APIs/Sanity/index.ts @@ -1,6 +1,7 @@ -export { getContacts } from './contacts'; -export { getCertificates } from './certificates'; -export { getEducationCourses } from './educationCourses'; -export { getInternships } from './internships'; -export { getProjects } from './projects'; -export { getSkills } from './skills'; \ No newline at end of file +export { getContactsPage } from './contacts'; +export { getEducationPage } from './education'; +export { getProjectsPage } from './projects'; +export { getSkillsPage } from './skills'; +export { getAboutPage } from './about'; +export { getExperiencePage } from './experience'; +export { getNavbarData } from './navbar'; \ No newline at end of file diff --git a/react-frontend/src/APIs/Sanity/internships.ts b/react-frontend/src/APIs/Sanity/internships.ts deleted file mode 100644 index 6561ad9..0000000 --- a/react-frontend/src/APIs/Sanity/internships.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { SanityInternship } from '../../Types'; -import sanityClient from './client'; - -const getInternships = async () => { - const query = `*[_type == "internships"]{ - title, - subTitle, - rank, - date, - link, - description, - "technologies": technologies[]->name - }`; - const result: SanityInternship[] = await sanityClient.fetch(query); - return result; -}; - -export { - getInternships, -} \ No newline at end of file diff --git a/react-frontend/src/APIs/Sanity/navbar.ts b/react-frontend/src/APIs/Sanity/navbar.ts new file mode 100644 index 0000000..7d652e3 --- /dev/null +++ b/react-frontend/src/APIs/Sanity/navbar.ts @@ -0,0 +1,12 @@ +import { SanityNavbarData } from '../../Types'; +import sanityClient from './client'; + +const getNavbarData = async () => { + const query = `*[_type == "portfolio"][0].navbar`; + const result: SanityNavbarData = await sanityClient.fetch(query); + return result; +}; + +export { + getNavbarData, +} \ No newline at end of file diff --git a/react-frontend/src/APIs/Sanity/projects.ts b/react-frontend/src/APIs/Sanity/projects.ts index f365ca8..8d422c1 100644 --- a/react-frontend/src/APIs/Sanity/projects.ts +++ b/react-frontend/src/APIs/Sanity/projects.ts @@ -1,19 +1,21 @@ -import { SanityProject } from '../../Types'; +import { SanityProjectsPage } from '../../Types'; import sanityClient from './client'; -const getProjects = async () => { - const query = `*[_type == "projects"]{ - name, - rank, - links, - description, - "imgSrc": image.asset->url, - "technologies": technologies[]->name +const getProjectsPage = async () => { + const query = `*[_type == "portfolio"][0].pages[_type == "projectsPage"][0] { + title, + "projects": projects[] -> { + name, + links, + description, + "imgSrc": image.asset->url, + "technologies": technologies[]->name + } }`; - const result: SanityProject[] = await sanityClient.fetch(query); + const result: SanityProjectsPage = await sanityClient.fetch(query); return result; }; export { - getProjects, + getProjectsPage, } \ No newline at end of file diff --git a/react-frontend/src/APIs/Sanity/skills.ts b/react-frontend/src/APIs/Sanity/skills.ts index 1316147..92c1380 100644 --- a/react-frontend/src/APIs/Sanity/skills.ts +++ b/react-frontend/src/APIs/Sanity/skills.ts @@ -1,16 +1,21 @@ -import { SanitySkill } from '../../Types'; +import { SanitySkillsPage } from '../../Types'; import sanityClient from './client'; -const getSkills = async () => { - const query = `*[_type == "skills" && rank >= 0]{ - "categoryName": category->name, - "iconURL": icon.asset->url, - name, rank +const getSkillsPage = async () => { + const query = `*[_type == "portfolio"][0].pages[_type == "skillsPage"][0] { + title, + "categories": categories[] { + title, + skills[] -> { + "iconURL": icon.asset->url, + name + } + } }`; - const result: SanitySkill[] = await sanityClient.fetch(query); + const result: SanitySkillsPage = await sanityClient.fetch(query); return result; }; export { - getSkills, + getSkillsPage, } \ No newline at end of file diff --git a/react-frontend/src/APIs/index.ts b/react-frontend/src/APIs/index.ts index 13b939e..ba50ca8 100644 --- a/react-frontend/src/APIs/index.ts +++ b/react-frontend/src/APIs/index.ts @@ -1,10 +1,9 @@ -export { getGithubImageURL, getResumeURL } from './ExternalResource'; - export { - getSkills, - getEducationCourses, - getInternships, - getProjects, - getContacts, - getCertificates + getSkillsPage, + getEducationPage, + getProjectsPage, + getContactsPage, + getExperiencePage, + getAboutPage, + getNavbarData } from './Sanity'; \ No newline at end of file diff --git a/react-frontend/src/Texts/about.ts b/react-frontend/src/Texts/about.ts deleted file mode 100644 index b3d4907..0000000 --- a/react-frontend/src/Texts/about.ts +++ /dev/null @@ -1,9 +0,0 @@ -export const aboutPageContent = { - salutation: "As-salamu alaykum!", - name: "I'm Shawky Ebrahim", - seeking: "I'm looking for an internship in", - position: "Software Development", - description: `I can be a valuable asset to your team and contribute to your projects with my skills and enthusiasm. - Please don't hesitate to check out my resume or reach out from the contacts page.`, - resume: "See My Resume", -} \ No newline at end of file diff --git a/react-frontend/src/Texts/contacts.ts b/react-frontend/src/Texts/contacts.ts deleted file mode 100644 index 3f89e24..0000000 --- a/react-frontend/src/Texts/contacts.ts +++ /dev/null @@ -1,4 +0,0 @@ -export const contactsPageContent = { - highlightedTitle: "Get in Touch", - titlePhrase: "How to Reach Me", -} \ No newline at end of file diff --git a/react-frontend/src/Texts/education.ts b/react-frontend/src/Texts/education.ts deleted file mode 100644 index d2a0efa..0000000 --- a/react-frontend/src/Texts/education.ts +++ /dev/null @@ -1,11 +0,0 @@ -export const educationPageContent = { - highlightedTitle: "Education", - titlePhrase: "As a computer science student", - college: { - name: "Faculty of Computers and Artificial Intelligence - Cairo University", - degree: "Bachelor of Science in Computer Science", - gpa: "GPA: 3.74", - fullDate: "From 6/2021 to 8/2025", - location: "Giza, Egypt", - } -} \ No newline at end of file diff --git a/react-frontend/src/Texts/experience.ts b/react-frontend/src/Texts/experience.ts deleted file mode 100644 index 8500725..0000000 --- a/react-frontend/src/Texts/experience.ts +++ /dev/null @@ -1,10 +0,0 @@ -export const experiencePageContent = { - internships: { - highlightedTitle: "Internships & Training", - titlePhrase: "How I Gained Real-World Experience", - }, - certificates: { - highlightedTitle: "Certificates", - titlePhrase: "How I Demonstrated My Excellence", - }, -} \ No newline at end of file diff --git a/react-frontend/src/Texts/index.ts b/react-frontend/src/Texts/index.ts deleted file mode 100644 index 67bbce7..0000000 --- a/react-frontend/src/Texts/index.ts +++ /dev/null @@ -1,13 +0,0 @@ -export { aboutPageContent } from "./about"; - -export { skillsPageContent } from "./skills"; - -export { educationPageContent } from "./education"; - -export { experiencePageContent } from "./experience"; - -export { projectsPageContent } from "./projects"; - -export { contactsPageContent } from "./contacts"; - -export { navbarContent, pages } from "./navbarContent"; \ No newline at end of file diff --git a/react-frontend/src/Texts/navbarContent.ts b/react-frontend/src/Texts/navbarContent.ts deleted file mode 100644 index c989b17..0000000 --- a/react-frontend/src/Texts/navbarContent.ts +++ /dev/null @@ -1,5 +0,0 @@ -export const navbarContent = { - logoText: "SHAWKY EBRAHIM" -} - -export const pages = ["about", "contact", "home", "projects"]; \ No newline at end of file diff --git a/react-frontend/src/Texts/projects.ts b/react-frontend/src/Texts/projects.ts deleted file mode 100644 index 1387051..0000000 --- a/react-frontend/src/Texts/projects.ts +++ /dev/null @@ -1,4 +0,0 @@ -export const projectsPageContent = { - highlightedTitle: "Projects", - titlePhrase: "What I Built With My Hands and Mind", -} \ No newline at end of file diff --git a/react-frontend/src/Texts/skills.ts b/react-frontend/src/Texts/skills.ts deleted file mode 100644 index 8324030..0000000 --- a/react-frontend/src/Texts/skills.ts +++ /dev/null @@ -1,4 +0,0 @@ -export const skillsPageContent = { - highlightedTitle: "Skills & Tools", - titlePhrase: "What I Know and Can Do", -} \ No newline at end of file diff --git a/react-frontend/src/Types/index.ts b/react-frontend/src/Types/index.ts index 0605a2e..7da0486 100644 --- a/react-frontend/src/Types/index.ts +++ b/react-frontend/src/Types/index.ts @@ -1,21 +1,12 @@ export { - type SanitySkill, - type SanityEducationCourse, - type SanityInternship, - type SanityProject, - type SanityContact, - type TechnologyCategory, - type SanityCertificate + type SanitySkillsPage, + type SanityEducationPage, + type SanityProjectsPage, + type SanityContactsPage, + type CommonTitle, + type SanityExperiencePage, + type SanityAboutPage, + type SanityNavbarData } from './sanity'; -export { type Theme, type Links } from './contexts'; - -export { type TechnologySkill } from './pages/skills'; - -export { type Course } from './pages/education'; - -export { type Internship, type Certificate } from './pages/experience'; - -export { type Project } from './pages/projects'; - -export { type Contact } from './pages/contacts'; \ No newline at end of file +export { type Theme, type Links } from './contexts'; \ No newline at end of file diff --git a/react-frontend/src/Types/pages/contacts.ts b/react-frontend/src/Types/pages/contacts.ts deleted file mode 100644 index 78ab25c..0000000 --- a/react-frontend/src/Types/pages/contacts.ts +++ /dev/null @@ -1 +0,0 @@ -export type { SanityContact as Contact } from "../sanity" \ No newline at end of file diff --git a/react-frontend/src/Types/pages/education.ts b/react-frontend/src/Types/pages/education.ts deleted file mode 100644 index 26753b8..0000000 --- a/react-frontend/src/Types/pages/education.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { SanityEducationCourse } from "../sanity"; - -export type Course = Omit; \ No newline at end of file diff --git a/react-frontend/src/Types/pages/experience.ts b/react-frontend/src/Types/pages/experience.ts deleted file mode 100644 index b77970b..0000000 --- a/react-frontend/src/Types/pages/experience.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { SanityInternship, SanityCertificate } from "../sanity"; - -export type Internship = Omit; - -export type Certificate = Omit; \ No newline at end of file diff --git a/react-frontend/src/Types/pages/projects.ts b/react-frontend/src/Types/pages/projects.ts deleted file mode 100644 index 4e83ce8..0000000 --- a/react-frontend/src/Types/pages/projects.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { SanityProject } from "../sanity"; - -export type Project = Omit; \ No newline at end of file diff --git a/react-frontend/src/Types/pages/skills.ts b/react-frontend/src/Types/pages/skills.ts deleted file mode 100644 index cbc0d50..0000000 --- a/react-frontend/src/Types/pages/skills.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { SanitySkill } from "../sanity"; - -export type TechnologySkill = Omit; diff --git a/react-frontend/src/Types/sanity.ts b/react-frontend/src/Types/sanity.ts deleted file mode 100644 index 1c47c3c..0000000 --- a/react-frontend/src/Types/sanity.ts +++ /dev/null @@ -1,55 +0,0 @@ -export type TechnologyCategory = "General" | "Frontend" | "Backend" | "Databases" | "Tools"; - -export type SanitySkill = { - name: string; - rank: number; - categoryName: TechnologyCategory; - iconURL: string; -} - -export type SanityEducationCourse = { - name: string; - rank: number; - description: string; - technologies: string[]; -} - -export type SanityInternship = { - title: string; - subTitle: string; - rank: number; - date: { - from: string; - to: string; - } - link: string; - description: string; - technologies: string[]; -} - -export type SanityProject = { - name: string; // title - rank: number; - links: { - demoLink: string; - projectLink: string; - } - description: string; - imgSrc: string; - technologies: string[]; -} - -export type SanityContact = { - imgSrc: string; - link: string; - name: string; -} - -export type SanityCertificate = { - title : string; - subTitle : string; - rank : number; - description? : string; - date : string; - link : string; -} diff --git a/react-frontend/src/Types/sanity/aboutPage.ts b/react-frontend/src/Types/sanity/aboutPage.ts new file mode 100644 index 0000000..0295b03 --- /dev/null +++ b/react-frontend/src/Types/sanity/aboutPage.ts @@ -0,0 +1,14 @@ +type Resume = { + link: string; + text: string; +} + +export type SanityAboutPage = { + personImage: string; + seeking: string; + personName: string; + description: string; + resume: Resume; + position: string; + salutation: string; +} \ No newline at end of file diff --git a/react-frontend/src/Types/sanity/common.ts b/react-frontend/src/Types/sanity/common.ts new file mode 100644 index 0000000..d4d6dd0 --- /dev/null +++ b/react-frontend/src/Types/sanity/common.ts @@ -0,0 +1,6 @@ +export type CommonTitle = { + title: { + highlightedText: string; + subText: string; + } +} \ No newline at end of file diff --git a/react-frontend/src/Types/sanity/contactsPage.ts b/react-frontend/src/Types/sanity/contactsPage.ts new file mode 100644 index 0000000..d7bc26d --- /dev/null +++ b/react-frontend/src/Types/sanity/contactsPage.ts @@ -0,0 +1,11 @@ +import { CommonTitle } from "./common"; + +type Contact = { + imgSrc: string; + link: string; + name: string; +} + +export type SanityContactsPage = CommonTitle & { + contacts: Contact[]; +} \ No newline at end of file diff --git a/react-frontend/src/Types/sanity/educationPage.ts b/react-frontend/src/Types/sanity/educationPage.ts new file mode 100644 index 0000000..079d65f --- /dev/null +++ b/react-frontend/src/Types/sanity/educationPage.ts @@ -0,0 +1,22 @@ +import { CommonTitle } from "./common"; + +type Date = { + start: string; + end: string; +} + +type Course = { + name: string; + description: string; + technologies: string[]; +} + +export type SanityEducationPage = CommonTitle & { + education: { + name: string; + description: string; + location: string; + date: Date; + courses: Course[]; + } +} \ No newline at end of file diff --git a/react-frontend/src/Types/sanity/experiencePage.ts b/react-frontend/src/Types/sanity/experiencePage.ts new file mode 100644 index 0000000..5b969e8 --- /dev/null +++ b/react-frontend/src/Types/sanity/experiencePage.ts @@ -0,0 +1,36 @@ +import { CommonTitle } from "./common"; + +type Date = { + from: string; + to: string; +} + +type Internship = { + title: string; + subTitle: string; + date: Date, + link: string; + description: string; + technologies: string[]; +} + +type Certificate = { + title: string; + subTitle: string; + description: string; + date: string; + link: string; +} + +type SanityInternshipsSection = CommonTitle & { + internships: Internship[]; +} + +type SanityCertificatesSection = CommonTitle & { + certificates: Certificate[]; +} + +export type SanityExperiencePage = { + certificatesSection: SanityCertificatesSection; + internshipsSection: SanityInternshipsSection; +} \ No newline at end of file diff --git a/react-frontend/src/Types/sanity/index.ts b/react-frontend/src/Types/sanity/index.ts new file mode 100644 index 0000000..c58aadd --- /dev/null +++ b/react-frontend/src/Types/sanity/index.ts @@ -0,0 +1,8 @@ +export { type CommonTitle } from './common'; +export { type SanityAboutPage } from './aboutPage'; +export { type SanityContactsPage } from './contactsPage'; +export { type SanityEducationPage } from './educationPage'; +export { type SanityExperiencePage } from './experiencePage'; +export { type SanityProjectsPage } from './projectsPage'; +export { type SanitySkillsPage } from './skillsPage'; +export { type SanityNavbarData } from './navbarData'; \ No newline at end of file diff --git a/react-frontend/src/Types/sanity/navbarData.ts b/react-frontend/src/Types/sanity/navbarData.ts new file mode 100644 index 0000000..87f9fd4 --- /dev/null +++ b/react-frontend/src/Types/sanity/navbarData.ts @@ -0,0 +1,3 @@ +export type SanityNavbarData = { + logo: string; +} \ No newline at end of file diff --git a/react-frontend/src/Types/sanity/projectsPage.ts b/react-frontend/src/Types/sanity/projectsPage.ts new file mode 100644 index 0000000..fa27be6 --- /dev/null +++ b/react-frontend/src/Types/sanity/projectsPage.ts @@ -0,0 +1,18 @@ +import { CommonTitle } from "./common"; + +type Links = { + demoLink: string; + projectLink: string; +} + +type Project = { + name: string; + links: Links; + description: string; + imgSrc: string; + technologies: string[]; +} + +export type SanityProjectsPage = CommonTitle & { + projects: Project[]; +} \ No newline at end of file diff --git a/react-frontend/src/Types/sanity/skillsPage.ts b/react-frontend/src/Types/sanity/skillsPage.ts new file mode 100644 index 0000000..4fb637e --- /dev/null +++ b/react-frontend/src/Types/sanity/skillsPage.ts @@ -0,0 +1,15 @@ +import { CommonTitle } from "./common"; + +type Skill = { + name: string; + iconURL: string; +} + +type Category = { + title: string; + skills: Skill[]; +} + +export type SanitySkillsPage = CommonTitle & { + categories: Category[]; +} \ No newline at end of file diff --git a/react-frontend/src/components/Icon/index.tsx b/react-frontend/src/components/Icon/index.tsx index 268c514..9ce666a 100644 --- a/react-frontend/src/components/Icon/index.tsx +++ b/react-frontend/src/components/Icon/index.tsx @@ -33,7 +33,7 @@ const motionProperties = { } export default function Icon({ - src = "images/placeholder.png", + src, alt, text, pointer = false, @@ -85,7 +85,7 @@ export default function Icon({ whileTap={motionProperties.whileTap} onClick={onClick} >
- {alt} + {alt}
{text && {text}} diff --git a/react-frontend/src/components/Loader/index.tsx b/react-frontend/src/components/Loader/index.tsx index 890ac15..0ca9d53 100644 --- a/react-frontend/src/components/Loader/index.tsx +++ b/react-frontend/src/components/Loader/index.tsx @@ -22,7 +22,6 @@ export default function Loader() { display: "flex", alignItems: "center", justifyContent: "center", - width: "100%", }), []); return ( diff --git a/react-frontend/src/components/Navbar/Logo.tsx b/react-frontend/src/components/Navbar/Logo.tsx index 46c8fbd..6400598 100644 --- a/react-frontend/src/components/Navbar/Logo.tsx +++ b/react-frontend/src/components/Navbar/Logo.tsx @@ -2,10 +2,9 @@ import { useCallback } from 'react' import { useThemeContext } from '../../contexts/ThemeContext'; import Text from '../Text' import { useNavigationControllerContext } from '../../contexts/NavigationControllerContext'; -import { Links } from '../../Types'; -import { navbarContent } from '../../Texts'; +import { Links, SanityNavbarData } from '../../Types'; -export default function Logo() { +export default function Logo({ logo }: Readonly>) { const { theme } = useThemeContext(); const { setLinks } = useNavigationControllerContext(); const changeLinksHandler = useCallback(() => { @@ -34,7 +33,7 @@ export default function Logo() { - {navbarContent.logoText} + {logo} ) diff --git a/react-frontend/src/components/Navbar/index.tsx b/react-frontend/src/components/Navbar/index.tsx index 2a0d468..f664cfe 100644 --- a/react-frontend/src/components/Navbar/index.tsx +++ b/react-frontend/src/components/Navbar/index.tsx @@ -1,11 +1,15 @@ -import { CSSProperties, useMemo } from 'react' +import { CSSProperties, useEffect, useMemo, useState } from 'react' import { useThemeContext } from '../../contexts/ThemeContext'; import Logo from './Logo' import Links from './Links'; +import { SanityNavbarData } from '../../Types'; +import { getNavbarData } from '../../APIs'; +import Loader from '../Loader'; export default function Navbar() { + const [navbarData, setNavbarData] = useState(null); const { theme } = useThemeContext(); - const outerStyle = useMemo(() : CSSProperties => ({ + const outerStyle = useMemo((): CSSProperties => ({ position: "fixed", padding: "1rem", width: "100%", @@ -16,7 +20,7 @@ export default function Navbar() { ...theme.bluryStyle.main, border: "none" }), [theme]); - const innerStyle = useMemo(() : CSSProperties => ({ + const innerStyle = useMemo((): CSSProperties => ({ display: 'flex', justifyContent: 'space-between', alignItems: 'center', @@ -27,10 +31,16 @@ export default function Navbar() { flexWrap: "wrap", }), []); + useEffect(() => { + getNavbarData().then((data) => { + setNavbarData(data); + }); + }, []); + return (
- + {navbarData ? : }
diff --git a/react-frontend/src/components/ProjectCard/index.tsx b/react-frontend/src/components/ProjectCard/index.tsx index be1b9a1..fbd48d8 100644 --- a/react-frontend/src/components/ProjectCard/index.tsx +++ b/react-frontend/src/components/ProjectCard/index.tsx @@ -41,7 +41,7 @@ export default function ProjectCard({ return (
diff --git a/react-frontend/src/containers/About/Content/Description.tsx b/react-frontend/src/containers/About/Content/Description.tsx index 332b34d..d74bc62 100644 --- a/react-frontend/src/containers/About/Content/Description.tsx +++ b/react-frontend/src/containers/About/Content/Description.tsx @@ -1,8 +1,8 @@ import { memo } from 'react'; import Text from '../../../components/Text'; -import { aboutPageContent } from '../../../Texts'; +import { SanityAboutPage } from '../../../Types'; -function Description() { +function Description({ description }: Readonly>) { return (
- {aboutPageContent.description.split("\n").map((paragraph, index) => ( + {description.split("\n").map((paragraph) => ( diff --git a/react-frontend/src/containers/About/Content/Name.tsx b/react-frontend/src/containers/About/Content/Name.tsx index 915ddf0..ae629e2 100644 --- a/react-frontend/src/containers/About/Content/Name.tsx +++ b/react-frontend/src/containers/About/Content/Name.tsx @@ -1,9 +1,9 @@ import { useThemeContext } from '../../../contexts/ThemeContext'; import Text from '../../../components/Text'; -import { aboutPageContent } from '../../../Texts'; import { memo, useMemo } from 'react'; +import { SanityAboutPage } from '../../../Types'; -function Name() { +function Name({ personName }: Readonly>) { const { theme } = useThemeContext(); const textStyle = useMemo(() => { return { @@ -15,7 +15,7 @@ function Name() { return ( - {aboutPageContent.name} + {personName} ) } diff --git a/react-frontend/src/containers/About/Content/Position.tsx b/react-frontend/src/containers/About/Content/Position.tsx index ae6eeaf..693dc24 100644 --- a/react-frontend/src/containers/About/Content/Position.tsx +++ b/react-frontend/src/containers/About/Content/Position.tsx @@ -1,9 +1,9 @@ import { useThemeContext } from '../../../contexts/ThemeContext'; import Text from '../../../components/Text'; -import { aboutPageContent } from '../../../Texts'; import { memo, useMemo } from 'react'; +import { SanityAboutPage } from '../../../Types'; -function Position() { +function Position({ position }: Readonly>) { const { theme } = useThemeContext(); const textStyle = useMemo(() => { return { @@ -17,7 +17,7 @@ function Position() { return ( - {aboutPageContent.position} + {position} ) } diff --git a/react-frontend/src/containers/About/Content/ResumeButton.tsx b/react-frontend/src/containers/About/Content/ResumeButton.tsx index 88888ef..963a2fa 100644 --- a/react-frontend/src/containers/About/Content/ResumeButton.tsx +++ b/react-frontend/src/containers/About/Content/ResumeButton.tsx @@ -1,18 +1,17 @@ import Button from '../../../components/Button'; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faFileLines } from '@fortawesome/free-solid-svg-icons'; -import { getResumeURL } from '../../../APIs'; -import { aboutPageContent } from '../../../Texts'; import { memo } from 'react'; +import { SanityAboutPage } from '../../../Types'; -function ResumeButton() { +function ResumeButton({ resume }: Readonly>) { return (