From 5e68eebef5093be05631d9f8eac403cbed959e9a Mon Sep 17 00:00:00 2001 From: s1lva Date: Thu, 17 Oct 2024 17:16:43 +0200 Subject: [PATCH] Mini code refactoring --- .../components/{ => Index}/Features.svelte | 2 +- .../{ => Index}/Introduction.svelte | 4 +- .../{ => MyProfile}/LinkForm.svelte | 0 .../{ => MyProfile}/SkillsForm.svelte | 0 .../{ => MyProfile}/UserLinks.svelte | 0 .../{ => MyProfile}/UserSkills.svelte | 0 .../{ => MyProfile}/UserStats.svelte | 0 src/lib/components/PublicProfile.svelte | 196 ------------------ .../components/PublicProfile/BasicInfo.svelte | 60 ++++++ .../PublicProfile/GithubStats.svelte | 50 +++++ src/lib/components/PublicProfile/Links.svelte | 37 ++++ .../PublicProfile/ProfileFooter.svelte | 8 + .../PublicProfile/PublicProfile.svelte | 33 +++ .../components/PublicProfile/TechStack.svelte | 46 ++++ .../UserNotFoundError.svelte | 0 .../{ => Shared}/LightDarkMode.svelte | 0 src/lib/components/{ => Shared}/Navbar.svelte | 2 +- .../components/{ => Shared}/NewSection.svelte | 0 src/routes/+page.svelte | 6 +- src/routes/[username]/+error.svelte | 2 +- src/routes/[username]/+page.svelte | 2 +- src/routes/profile/+layout.svelte | 2 +- src/routes/profile/+page.svelte | 10 +- 23 files changed, 249 insertions(+), 211 deletions(-) rename src/lib/components/{ => Index}/Features.svelte (89%) rename src/lib/components/{ => Index}/Introduction.svelte (92%) rename src/lib/components/{ => MyProfile}/LinkForm.svelte (100%) rename src/lib/components/{ => MyProfile}/SkillsForm.svelte (100%) rename src/lib/components/{ => MyProfile}/UserLinks.svelte (100%) rename src/lib/components/{ => MyProfile}/UserSkills.svelte (100%) rename src/lib/components/{ => MyProfile}/UserStats.svelte (100%) delete mode 100644 src/lib/components/PublicProfile.svelte create mode 100644 src/lib/components/PublicProfile/BasicInfo.svelte create mode 100644 src/lib/components/PublicProfile/GithubStats.svelte create mode 100644 src/lib/components/PublicProfile/Links.svelte create mode 100644 src/lib/components/PublicProfile/ProfileFooter.svelte create mode 100644 src/lib/components/PublicProfile/PublicProfile.svelte create mode 100644 src/lib/components/PublicProfile/TechStack.svelte rename src/lib/components/{ => PublicProfile}/UserNotFoundError.svelte (100%) rename src/lib/components/{ => Shared}/LightDarkMode.svelte (100%) rename src/lib/components/{ => Shared}/Navbar.svelte (94%) rename src/lib/components/{ => Shared}/NewSection.svelte (100%) diff --git a/src/lib/components/Features.svelte b/src/lib/components/Index/Features.svelte similarity index 89% rename from src/lib/components/Features.svelte rename to src/lib/components/Index/Features.svelte index f2499a6..e5d0cc2 100644 --- a/src/lib/components/Features.svelte +++ b/src/lib/components/Index/Features.svelte @@ -1,5 +1,5 @@ diff --git a/src/lib/components/Introduction.svelte b/src/lib/components/Index/Introduction.svelte similarity index 92% rename from src/lib/components/Introduction.svelte rename to src/lib/components/Index/Introduction.svelte index b33616d..b621c08 100644 --- a/src/lib/components/Introduction.svelte +++ b/src/lib/components/Index/Introduction.svelte @@ -1,5 +1,5 @@ - - - -
-
- -
- - - ? - -
- {#if githubData.name} -

{githubData.name}

- {:else} -

{userData.username}

- {/if} - - {#if githubData.bio} -

{githubData.bio}

- {:else} -

Public Developer Profile

- {/if} - - {#if githubData.company} -

Currently at {githubData.company}

- {/if} -
-
- -
- {#if githubData.blog} -
- -
- {/if} -
-
-
- - -
- - - -
- - Projects on GitHub -
-
- -
{githubData.repoCount}
-
-
- - - - -
- - GitHub Contributions (Past 30 Days) -
-
- -
{githubData.contributionsCount}
-
-
- - - - -
- - Github Followers -
-
- -
{githubData.followers}
-
-
-
- - -
- - - - Links - - Discover the developer's projects and favorite resources - - - - {#if userData.links.length > 0} - - - - Title - - - - {#each userData.links as link} - - - {link.title} - - - {/each} - - - {:else} -

No links available

- {/if} -
-
- - - - - Tech Stack - Explore the developer's skills and expertise - - - {#if userData.skills.length > 0} - {#each userData.skills as skill} -
- {skill.title} - -
- {/each} - {:else} -

No skills available

- {/if} -
-
-
-
-

- Do you want one? Create yours here. -

- -
-
-
diff --git a/src/lib/components/PublicProfile/BasicInfo.svelte b/src/lib/components/PublicProfile/BasicInfo.svelte new file mode 100644 index 0000000..c77379a --- /dev/null +++ b/src/lib/components/PublicProfile/BasicInfo.svelte @@ -0,0 +1,60 @@ + + + +
+ + + ? + +
+ {#if githubData.name} +

{githubData.name}

+ {:else} +

{userData.username}

+ {/if} + + {#if githubData.bio} +

{githubData.bio}

+ {:else} +

Public Developer Profile

+ {/if} + + {#if githubData.company} +

Currently at {githubData.company}

+ {/if} +
+
+ +
+ {#if githubData.blog} +
+ +
+ {/if} +
+
+
diff --git a/src/lib/components/PublicProfile/GithubStats.svelte b/src/lib/components/PublicProfile/GithubStats.svelte new file mode 100644 index 0000000..548206a --- /dev/null +++ b/src/lib/components/PublicProfile/GithubStats.svelte @@ -0,0 +1,50 @@ + + + +
+ + + +
+ + Projects on GitHub +
+
+ +
{githubData.repoCount}
+
+
+ + + + +
+ + GitHub Contributions (Past 30 Days) +
+
+ +
{githubData.contributionsCount}
+
+
+ + + + +
+ + Github Followers +
+
+ +
{githubData.followers}
+
+
+
diff --git a/src/lib/components/PublicProfile/Links.svelte b/src/lib/components/PublicProfile/Links.svelte new file mode 100644 index 0000000..89c0dce --- /dev/null +++ b/src/lib/components/PublicProfile/Links.svelte @@ -0,0 +1,37 @@ + + + + + + Links + Discover the developer's projects and favorite resources + + + {#if userData.links.length > 0} + + + + Title + + + + {#each userData.links as link} + + + {link.title} + + + {/each} + + + {:else} +

No links available

+ {/if} +
+
diff --git a/src/lib/components/PublicProfile/ProfileFooter.svelte b/src/lib/components/PublicProfile/ProfileFooter.svelte new file mode 100644 index 0000000..8c3c772 --- /dev/null +++ b/src/lib/components/PublicProfile/ProfileFooter.svelte @@ -0,0 +1,8 @@ + + +

+ Do you want one? Create yours here. +

+ diff --git a/src/lib/components/PublicProfile/PublicProfile.svelte b/src/lib/components/PublicProfile/PublicProfile.svelte new file mode 100644 index 0000000..3e25386 --- /dev/null +++ b/src/lib/components/PublicProfile/PublicProfile.svelte @@ -0,0 +1,33 @@ + + + +
+
+ + + + +
+ + +
+
+ +
+
+
diff --git a/src/lib/components/PublicProfile/TechStack.svelte b/src/lib/components/PublicProfile/TechStack.svelte new file mode 100644 index 0000000..51823d7 --- /dev/null +++ b/src/lib/components/PublicProfile/TechStack.svelte @@ -0,0 +1,46 @@ + + + + + + Tech Stack + Explore the developer's skills and expertise + + + {#if userData.skills.length > 0} + {#each userData.skills as skill} +
+ {skill.title} + +
+ {/each} + {:else} +

No skills available

+ {/if} +
+
diff --git a/src/lib/components/UserNotFoundError.svelte b/src/lib/components/PublicProfile/UserNotFoundError.svelte similarity index 100% rename from src/lib/components/UserNotFoundError.svelte rename to src/lib/components/PublicProfile/UserNotFoundError.svelte diff --git a/src/lib/components/LightDarkMode.svelte b/src/lib/components/Shared/LightDarkMode.svelte similarity index 100% rename from src/lib/components/LightDarkMode.svelte rename to src/lib/components/Shared/LightDarkMode.svelte diff --git a/src/lib/components/Navbar.svelte b/src/lib/components/Shared/Navbar.svelte similarity index 94% rename from src/lib/components/Navbar.svelte rename to src/lib/components/Shared/Navbar.svelte index 898f965..9277b9e 100644 --- a/src/lib/components/Navbar.svelte +++ b/src/lib/components/Shared/Navbar.svelte @@ -7,7 +7,7 @@ import { page } from '$app/stores'; import * as Avatar from '$lib/components/ui/avatar'; - import LightDarkMode from './LightDarkMode.svelte'; + import LightDarkMode from '$lib/components/Shared/LightDarkMode.svelte';
diff --git a/src/lib/components/NewSection.svelte b/src/lib/components/Shared/NewSection.svelte similarity index 100% rename from src/lib/components/NewSection.svelte rename to src/lib/components/Shared/NewSection.svelte diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index e15f068..36fff3d 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -1,7 +1,7 @@ diff --git a/src/routes/[username]/+error.svelte b/src/routes/[username]/+error.svelte index 0b2b739..76e5881 100644 --- a/src/routes/[username]/+error.svelte +++ b/src/routes/[username]/+error.svelte @@ -1,5 +1,5 @@ diff --git a/src/routes/[username]/+page.svelte b/src/routes/[username]/+page.svelte index 09a0588..c63eaa3 100644 --- a/src/routes/[username]/+page.svelte +++ b/src/routes/[username]/+page.svelte @@ -1,5 +1,5 @@ diff --git a/src/routes/profile/+page.svelte b/src/routes/profile/+page.svelte index fae60c4..d5111ee 100644 --- a/src/routes/profile/+page.svelte +++ b/src/routes/profile/+page.svelte @@ -3,11 +3,11 @@ import { Button } from '$lib/components/ui/button'; import type { PageData } from './$types'; - import LinkForm from '$lib/components/LinkForm.svelte'; - import UserStats from '$lib/components/UserStats.svelte'; - import UserLinks from '$lib/components/UserLinks.svelte'; - import SkillsForm from '$lib/components/SkillsForm.svelte'; - import UserSkills from '$lib/components/UserSkills.svelte'; + import LinkForm from '$lib/components/MyProfile/LinkForm.svelte'; + import UserStats from '$lib/components/MyProfile/UserStats.svelte'; + import UserLinks from '$lib/components/MyProfile/UserLinks.svelte'; + import SkillsForm from '$lib/components/MyProfile/SkillsForm.svelte'; + import UserSkills from '$lib/components/MyProfile/UserSkills.svelte'; import { ArrowUpRight, Trash2 } from 'lucide-svelte'; import { enhance } from '$app/forms'; import { confirmDelete } from '$lib/utils/confirmDelete';