Skip to content

Commit

Permalink
Merge pull request #43 from s1lvax/bugfix/code-refactoring
Browse files Browse the repository at this point in the history
Mini code refactoring
  • Loading branch information
s1lvax authored Oct 17, 2024
2 parents f6da583 + 5e68eeb commit a1e0c5a
Show file tree
Hide file tree
Showing 23 changed files with 249 additions and 211 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script>
import NewSection from '$lib/components/NewSection.svelte';
import NewSection from '$lib/components/Shared/NewSection.svelte';
import { features } from '$lib/constants/features';
import * as Card from '$lib/components/ui/card';
</script>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import NewSection from '$lib/components/NewSection.svelte';
import NewSection from '$lib/components/Shared/NewSection.svelte';
import { Button } from '$lib/components/ui/button';
import { GitPullRequestCreate, UserPen, Github, LogOut } from 'lucide-svelte';
Expand Down Expand Up @@ -30,7 +30,7 @@
{/if}

<Button
href="https://github.com/s1lvax/connekt"
href="https://github.com/s1lvax/route"
target="_blank"
variant="outline"
class="flex items-center space-x-2"><GitPullRequestCreate /> <span>Contribute</span></Button
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
196 changes: 0 additions & 196 deletions src/lib/components/PublicProfile.svelte

This file was deleted.

60 changes: 60 additions & 0 deletions src/lib/components/PublicProfile/BasicInfo.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<script lang="ts">
import * as Avatar from '$lib/components/ui/avatar';
import { Button } from '$lib/components/ui/button';
import { IdCard } from 'lucide-svelte';
import GitHub from 'lucide-svelte/icons/github';
import type { GithubData } from '$lib/types/GithubData';
import type { PublicProfile } from '$lib/types/PublicProfile';
export let githubData: GithubData;
export let userData: PublicProfile;
</script>

<!-- User Avatar and Basic Info -->
<div class="flex items-center justify-center space-x-4">
<Avatar.Root class="h-24 w-24 rounded-full">
<Avatar.Image src={githubData.avatarUrl} alt="User Avatar" />
<Avatar.Fallback>?</Avatar.Fallback>
</Avatar.Root>
<div class="flex flex-col space-y-4 text-center">
{#if githubData.name}
<p class="text-2xl font-bold">{githubData.name}</p>
{:else}
<p class="text-xl font-bold">{userData.username}</p>
{/if}

{#if githubData.bio}
<p class="text-muted-foreground">{githubData.bio}</p>
{:else}
<p class="text-muted-foreground">Public Developer Profile</p>
{/if}

{#if githubData.company}
<p class="text-muted-foreground">Currently at {githubData.company}</p>
{/if}
<div class="flex flex-row items-center justify-center gap-4">
<div>
<Button
href={githubData.url}
target="_blank"
class="mt-2 flex justify-center rounded-full"
variant="outline"
>
<GitHub />
</Button>
</div>
{#if githubData.blog}
<div>
<Button
href={githubData.blog}
target="_blank"
class="mt-2 flex justify-center rounded-full"
variant="outline"
>
<IdCard />
</Button>
</div>
{/if}
</div>
</div>
</div>
50 changes: 50 additions & 0 deletions src/lib/components/PublicProfile/GithubStats.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<script lang="ts">
import * as Card from '$lib/components/ui/card';
import type { GithubData } from '$lib/types/GithubData';
import { Folder } from 'lucide-svelte';
import GitHub from 'lucide-svelte/icons/github';
export let githubData: GithubData;
</script>

<!-- GitHub Stats Cards -->
<div class="mt-8 grid gap-4 md:grid-cols-2 lg:grid-cols-3">
<!-- Total Projects (Repo Count) Card -->
<Card.Root>
<Card.Header class="flex flex-row items-center justify-between space-y-0 pb-2">
<div class="flex items-center space-x-2">
<Folder class="h-4 w-4 text-muted-foreground" />
<Card.Title class="text-sm font-medium">Projects on GitHub</Card.Title>
</div>
</Card.Header>
<Card.Content>
<div class="text-2xl font-bold">{githubData.repoCount}</div>
</Card.Content>
</Card.Root>

<!-- GitHub Contributions Card -->
<Card.Root>
<Card.Header class="flex flex-row items-center justify-between space-y-0 pb-2">
<div class="flex items-center space-x-2">
<GitHub class="h-4 w-4 text-muted-foreground" />
<Card.Title class="text-sm font-medium">GitHub Contributions (Past 30 Days)</Card.Title>
</div>
</Card.Header>
<Card.Content>
<div class="text-2xl font-bold">{githubData.contributionsCount}</div>
</Card.Content>
</Card.Root>

<!-- Praise Received Card -->
<Card.Root>
<Card.Header class="flex flex-row items-center justify-between space-y-0 pb-2">
<div class="flex items-center space-x-2">
<GitHub class="h-4 w-4 text-muted-foreground" />
<Card.Title class="text-sm font-medium">Github Followers</Card.Title>
</div>
</Card.Header>
<Card.Content>
<div class="text-2xl font-bold">{githubData.followers}</div>
</Card.Content>
</Card.Root>
</div>
37 changes: 37 additions & 0 deletions src/lib/components/PublicProfile/Links.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<script lang="ts">
import * as Table from '$lib/components/ui/table';
import * as Card from '$lib/components/ui/card';
import type { PublicProfile } from '$lib/types/PublicProfile';
export let userData: PublicProfile;
</script>

<!-- Links Section -->
<Card.Root>
<Card.Header>
<Card.Title>Links</Card.Title>
<Card.Description>Discover the developer's projects and favorite resources</Card.Description>
</Card.Header>
<Card.Content class="grid gap-4">
{#if userData.links.length > 0}
<Table.Root>
<Table.Header>
<Table.Row>
<Table.Head>Title</Table.Head>
</Table.Row>
</Table.Header>
<Table.Body>
{#each userData.links as link}
<a href={link.url} target="_blank">
<Table.Row class="flex flex-row space-x-4 hover:cursor-pointer">
<Table.Cell class="font-medium">{link.title}</Table.Cell>
</Table.Row>
</a>
{/each}
</Table.Body>
</Table.Root>
{:else}
<p class="text-muted-foreground">No links available</p>
{/if}
</Card.Content>
</Card.Root>
8 changes: 8 additions & 0 deletions src/lib/components/PublicProfile/ProfileFooter.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<script>
import LightDarkMode from '$lib/components/Shared/LightDarkMode.svelte';
</script>

<p class="text-sm text-muted-foreground">
Do you want one? <a href="/" class="text-blue-600 underline">Create yours here.</a>
</p>
<LightDarkMode />
Loading

0 comments on commit a1e0c5a

Please sign in to comment.