diff --git a/package.json b/package.json index 5e95b7f..154afad 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "@tailwindcss/typography": "^0.5.14", "@types/eslint": "^9.6.0", "autoprefixer": "^10.4.20", + "bits-ui": "^0.21.16", "eslint": "^9.0.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-svelte": "^2.36.0", @@ -43,7 +44,6 @@ "@auth/core": "^0.37.0", "@auth/sveltekit": "^1.7.0", "@prisma/client": "5.21.1", - "bits-ui": "^0.21.16", "clsx": "^2.1.1", "formsnap": "^1.0.1", "lucide-svelte": "^0.451.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4095fac..eb0010d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -17,9 +17,6 @@ importers: '@prisma/client': specifier: 5.21.1 version: 5.21.1(prisma@5.21.1) - bits-ui: - specifier: ^0.21.16 - version: 0.21.16(svelte@4.2.19) clsx: specifier: ^2.1.1 version: 2.1.1 @@ -66,6 +63,9 @@ importers: autoprefixer: specifier: ^10.4.20 version: 10.4.20(postcss@8.4.47) + bits-ui: + specifier: ^0.21.16 + version: 0.21.16(svelte@4.2.19) eslint: specifier: ^9.0.0 version: 9.12.0(jiti@1.21.6) diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 4acf6fb..06596f7 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -14,14 +14,15 @@ datasource db { } model User { - id Int @id @default(autoincrement()) - githubId Int @unique - githubUsername String @unique - views Int @default(0) - createdAt DateTime @default(now()) - updatedAt DateTime @updatedAt - Link Link[] - Skill Skill[] + id Int @id @default(autoincrement()) + githubId Int @unique + githubUsername String @unique + views Int @default(0) + openToCollaborating Boolean @default(false) + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + Link Link[] + Skill Skill[] } model Link { diff --git a/src/app.html b/src/app.html index 4511dc5..d325e25 100644 --- a/src/app.html +++ b/src/app.html @@ -4,6 +4,10 @@ + diff --git a/src/lib/components/Index/CTA.svelte b/src/lib/components/Index/CTA.svelte new file mode 100644 index 0000000..4842688 --- /dev/null +++ b/src/lib/components/Index/CTA.svelte @@ -0,0 +1,31 @@ + + +
+
+
+

+ Ready to Showcase Your Developer Profile? +

+

+ Start building a custom, developer-driven profile today. Share your projects, skills, and + GitHub stats with the world in just a few clicks. +

+
+ {#if $page.data.session} + + {:else} + + {/if} +
+
+
+
diff --git a/src/lib/components/Index/Contributors.svelte b/src/lib/components/Index/Contributors.svelte new file mode 100644 index 0000000..f8d446d --- /dev/null +++ b/src/lib/components/Index/Contributors.svelte @@ -0,0 +1,49 @@ + + +
+
+ +
+
+

+ Meet our contributors +

+
+

+ Built by developers, for developers. Meet the contributors who make this project possible. +

+
+
+
diff --git a/src/lib/components/Index/Features.svelte b/src/lib/components/Index/Features.svelte index e5d0cc2..9046c1a 100644 --- a/src/lib/components/Index/Features.svelte +++ b/src/lib/components/Index/Features.svelte @@ -1,23 +1,38 @@ - -
- {#each features as feature} - - - - - {feature.name} - - - - {feature.description} - - - {/each} +
+
+
+

+ Unleash the Power of Your Developer Profile +

+

+ Designed to showcase your skills, projects, and contributions effortlessly, Route empowers + developers to tell their story with ease. +

+
+
+
+ {#each features as feature} +
+
+
+ +
+ {feature.name} +
+
+

+ {feature.description} +

+
+
+ {/each} +
+
- +
diff --git a/src/lib/components/Index/Footer.svelte b/src/lib/components/Index/Footer.svelte new file mode 100644 index 0000000..8ec063b --- /dev/null +++ b/src/lib/components/Index/Footer.svelte @@ -0,0 +1,19 @@ + + + diff --git a/src/lib/components/Index/Hero.svelte b/src/lib/components/Index/Hero.svelte new file mode 100644 index 0000000..3cc789c --- /dev/null +++ b/src/lib/components/Index/Hero.svelte @@ -0,0 +1,74 @@ + + +
+
+
+ +

+ Your Developer Identity, Streamlined and Simplified +

+

+ Create a profile that highlights your GitHub stats and key projects—simple, clean, and + yours. +

+
+ {#if $page.data.session} + + + {:else} + + {/if} +
+
+
+
+ App screenshot +
+
+
+
diff --git a/src/lib/components/Index/Introduction.svelte b/src/lib/components/Index/Introduction.svelte deleted file mode 100644 index b621c08..0000000 --- a/src/lib/components/Index/Introduction.svelte +++ /dev/null @@ -1,39 +0,0 @@ - - - -

- Build, Connect, and Showcase with Route -

-

- Keep your GitHub activity live, showcase your tools, and create a portfolio that highlights your - skills—all in one dynamic platform. -

-
- {#if $page.data.session} - - - {:else} - - {/if} - - -
-
diff --git a/src/lib/components/PublicProfile/BasicInfo.svelte b/src/lib/components/PublicProfile/BasicInfo.svelte index fdfce31..1481c7b 100644 --- a/src/lib/components/PublicProfile/BasicInfo.svelte +++ b/src/lib/components/PublicProfile/BasicInfo.svelte @@ -6,6 +6,7 @@ import { Skeleton } from '$lib/components/ui/skeleton'; import type { GithubData } from '$lib/types/GithubData'; import type { PublicProfile } from '$lib/types/PublicProfile'; + import { Badge } from '$lib/components/ui/badge'; export let githubData: GithubData | null; export let userData: PublicProfile; @@ -24,7 +25,20 @@
{#if githubData} {#if githubData.name} -

{githubData.name}

+
+

{githubData.name}

+
+ {#if userData.isOpenToCollaborating} + Open to Collaborating + {:else} + Not Open to Collaborating + {/if} +
+
{:else}

{userData.username}

{/if} diff --git a/src/lib/components/PublicProfile/TechStack.svelte b/src/lib/components/PublicProfile/TechStack.svelte index 51823d7..70f1145 100644 --- a/src/lib/components/PublicProfile/TechStack.svelte +++ b/src/lib/components/PublicProfile/TechStack.svelte @@ -23,7 +23,7 @@ - Tech Stack + Skills & Tools Explore the developer's skills and expertise diff --git a/src/lib/components/ui/separator/index.ts b/src/lib/components/ui/separator/index.ts new file mode 100644 index 0000000..82442d2 --- /dev/null +++ b/src/lib/components/ui/separator/index.ts @@ -0,0 +1,7 @@ +import Root from "./separator.svelte"; + +export { + Root, + // + Root as Separator, +}; diff --git a/src/lib/components/ui/separator/separator.svelte b/src/lib/components/ui/separator/separator.svelte new file mode 100644 index 0000000..aa61f69 --- /dev/null +++ b/src/lib/components/ui/separator/separator.svelte @@ -0,0 +1,22 @@ + + + diff --git a/src/lib/components/ui/switch/index.ts b/src/lib/components/ui/switch/index.ts new file mode 100644 index 0000000..f5533db --- /dev/null +++ b/src/lib/components/ui/switch/index.ts @@ -0,0 +1,7 @@ +import Root from "./switch.svelte"; + +export { + Root, + // + Root as Switch, +}; diff --git a/src/lib/components/ui/switch/switch.svelte b/src/lib/components/ui/switch/switch.svelte new file mode 100644 index 0000000..d61db5d --- /dev/null +++ b/src/lib/components/ui/switch/switch.svelte @@ -0,0 +1,28 @@ + + + + + diff --git a/src/lib/constants/features.ts b/src/lib/constants/features.ts index 0123372..d4390e8 100644 --- a/src/lib/constants/features.ts +++ b/src/lib/constants/features.ts @@ -12,7 +12,7 @@ export const features = [ icon: Github }, { - name: 'Tech Stack', + name: 'Skills & Tools', description: 'Showcase your preferred tools and technologies with sleek graphs.', icon: ChartArea }, @@ -24,8 +24,7 @@ export const features = [ }, { name: 'Open Source', - description: - 'Join a thriving open-source community, contribute to projects, and showcase your own contributions.', + description: 'Join a thriving open-source community and help us make all software open-source.', icon: GitPullRequestArrow } ]; diff --git a/src/lib/constants/socials.ts b/src/lib/constants/socials.ts new file mode 100644 index 0000000..e985749 --- /dev/null +++ b/src/lib/constants/socials.ts @@ -0,0 +1,10 @@ +// features.ts +import { Github } from 'lucide-svelte'; + +export const socials = [ + { + name: 'GitHub', + link: 'https://github.com/s1lvax/route', + icon: Github + } +]; diff --git a/src/lib/types/GithubData.ts b/src/lib/types/GithubData.ts index e794ba8..126136b 100644 --- a/src/lib/types/GithubData.ts +++ b/src/lib/types/GithubData.ts @@ -14,3 +14,25 @@ export interface GithubData { export interface GitHubEvent { created_at: string; } + +export interface Contributor { + login: string; + id: number; + node_id: string; + avatar_url: string; + gravatar_id: string; + url: string; + html_url: string; + followers_url: string; + following_url: string; + gists_url: string; + starred_url: string; + subscriptions_url: string; + organizations_url: string; + repos_url: string; + events_url: string; + received_events_url: string; + type: string; + site_admin: boolean; + contributions: number; +} diff --git a/src/lib/types/PublicProfile.ts b/src/lib/types/PublicProfile.ts index 1c03d94..51a2ee4 100644 --- a/src/lib/types/PublicProfile.ts +++ b/src/lib/types/PublicProfile.ts @@ -2,4 +2,5 @@ export interface PublicProfile { links: Array<{ title: string; url: string }>; skills: Array<{ title: string; level: string }>; username: string; + isOpenToCollaborating: boolean; } diff --git a/src/lib/types/User.ts b/src/lib/types/User.ts index 4a5e052..8a9d82d 100644 --- a/src/lib/types/User.ts +++ b/src/lib/types/User.ts @@ -3,5 +3,6 @@ export interface User { githubId: number; githubUsername: string; views: number; + openToCollaborating: boolean; updatedAt: Date; } diff --git a/src/lib/utils/updateOpenToCollaborating.ts b/src/lib/utils/updateOpenToCollaborating.ts new file mode 100644 index 0000000..787475d --- /dev/null +++ b/src/lib/utils/updateOpenToCollaborating.ts @@ -0,0 +1,27 @@ +import { prisma } from '$lib/server/prisma'; + +export const updateOpenToCollaborating = async (githubId: number) => { + try { + // fetch current state + const user = await prisma.user.findUnique({ + where: { githubId: githubId }, + select: { openToCollaborating: true } + }); + + if (!user) { + throw new Error('User not found'); + } + + // generate new value + const newOpenToCollaboratingValue = !user.openToCollaborating; + + // update db + await prisma.user.update({ + where: { githubId: githubId }, + data: { openToCollaborating: newOpenToCollaboratingValue } + }); + } catch (error) { + console.log(error); + throw new Error('Failed to update openToCollaborating status'); + } +}; diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 36fff3d..4aa96b8 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -1,9 +1,17 @@ - - - +
+ + + + + +
+
diff --git a/src/routes/[username]/+page.server.ts b/src/routes/[username]/+page.server.ts index 8be907e..2ca9b11 100644 --- a/src/routes/[username]/+page.server.ts +++ b/src/routes/[username]/+page.server.ts @@ -35,10 +35,16 @@ export const load: PageServerLoad = async ({ params }) => { orderBy: [{ order: 'asc' }] }); + const isOpenToCollaborating = await prisma.user.findUnique({ + where: { githubId: user.githubId }, + select: { openToCollaborating: true } + }); + const userData = { links, skills, - username: username + username: username, + isOpenToCollaborating: isOpenToCollaborating?.openToCollaborating }; return { diff --git a/src/routes/profile/+page.server.ts b/src/routes/profile/+page.server.ts index b69fa72..01c0ac0 100644 --- a/src/routes/profile/+page.server.ts +++ b/src/routes/profile/+page.server.ts @@ -9,6 +9,7 @@ import { linksSchema } from '$lib/schemas/links'; import type { User } from '$lib/types/User'; import { skillsSchema } from '$lib/schemas/skills'; import { deleteUser } from '$lib/utils/deleteUser'; +import { updateOpenToCollaborating } from '$lib/utils/updateOpenToCollaborating'; // Define the user variable with a possible null let user: User | null = null; @@ -57,7 +58,8 @@ export const load: PageServerLoad = async (event) => { // Create userStats object const userData = { username: user.githubUsername, - views: user.views || 0 + views: user.views || 0, + openToCollaborating: user.openToCollaborating }; // Initialize forms using superValidate @@ -89,9 +91,9 @@ export const actions: Actions = { if (user) { try { - const linkCount = await prisma.link.count({where: { userId: user.githubId }}); + const linkCount = await prisma.link.count({ where: { userId: user.githubId } }); if (linkCount >= 15) { - return fail(400, {form, message: 'You have reached the maximum limit of 15 links.'}); + return fail(400, { form, message: 'You have reached the maximum limit of 15 links.' }); } await prisma.link.create({ data: { @@ -148,9 +150,9 @@ export const actions: Actions = { if (user) { try { - const skillCount = await prisma.skill.count({where :{userId:user.githubId}}); + const skillCount = await prisma.skill.count({ where: { userId: user.githubId } }); if (skillCount >= 15) { - return fail(400, {form,message:'You have reached the maximum limit of 15 skills'}) + return fail(400, { form, message: 'You have reached the maximum limit of 15 skills' }); } await prisma.skill.create({ data: { @@ -214,5 +216,18 @@ export const actions: Actions = { } } throw redirect(303, '/'); + }, + updateOpenToCollaborating: async () => { + console.log('Updating openToCollaborating status'); + //delete user + if (user) { + try { + // update value + updateOpenToCollaborating(user.githubId); + } catch (error) { + console.log(error); + throw Error('Failed to delete user'); + } + } } }; diff --git a/src/routes/profile/+page.svelte b/src/routes/profile/+page.svelte index a99a34c..2ea069d 100644 --- a/src/routes/profile/+page.svelte +++ b/src/routes/profile/+page.svelte @@ -2,6 +2,7 @@ import * as Card from '$lib/components/ui/card'; import { Button } from '$lib/components/ui/button'; import type { PageData } from './$types'; + import { Separator } from '$lib/components/ui/separator/index.js'; import LinkForm from '$lib/components/MyProfile/LinkForm.svelte'; import UserStats from '$lib/components/MyProfile/UserStats.svelte'; @@ -16,6 +17,9 @@ import { onMount } from 'svelte'; import type { PrivateProfileData } from '$lib/types/PrivateProfileData'; + import { Label } from '$lib/components/ui/label/index.js'; + import { Switch } from '$lib/components/ui/switch/index.js'; + let githubData: GithubData | null = null; let privateProfileData: PrivateProfileData | null = null; export let data: PageData; @@ -43,6 +47,26 @@
+
+
+
+ +
+
+
+