Skip to content

Commit

Permalink
format + lint
Browse files Browse the repository at this point in the history
  • Loading branch information
DexterStorey committed Jan 13, 2024
1 parent 702b468 commit 6175387
Show file tree
Hide file tree
Showing 37 changed files with 715 additions and 692 deletions.
2 changes: 1 addition & 1 deletion app/api/webhook/github/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import {GITHUB} from '~/constants'
import prisma from '~/prisma'
import {stripe} from '~/stripe'
import {Label, Repository} from '~/types'
import {validateSignature} from '~/utils/index'
import Weaviate from '~/utils/embeddings/db'
import {getMainBranch, getRepoMeta, openUsageIssue} from '~/utils/github'
import {validateSignature} from '~/utils/index'
import {incrementUsage} from '~/utils/payment'

export const maxDuration = 300
Expand Down
13 changes: 7 additions & 6 deletions app/auth/page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React from 'react'
import { Landing } from '~/components/dashboard/Landing'
import {Landing} from '~/components/dashboard/Landing'

type Props = {}

export default function SignIN({}: Props) {
return (
<div><Landing/></div>
)
}
return (
<div>
<Landing />
</div>
)
}
6 changes: 3 additions & 3 deletions app/dashboard/(base)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {ApplicationProvider} from 'lib/components/dashboard/ApplicationProvider'
import {Toaster} from 'sonner'
import BackgroundGrid from '~/components/background-grid'
import {MainNavigation} from '~/components/dashboard/Navigation'

export default async function RootLayout({
Expand All @@ -13,8 +12,9 @@ export default async function RootLayout({
<Toaster />
<ApplicationProvider>
<MainNavigation />
<div className='h-full w-full flex flex-col'>
<div className='xl:px-24 bg-transparent z-10 grid w-full'>{children}</div></div>
<div className='flex h-full w-full flex-col'>
<div className='z-10 grid w-full bg-transparent xl:px-24'>{children}</div>
</div>
</ApplicationProvider>
</div>
)
Expand Down
4 changes: 2 additions & 2 deletions app/dashboard/(base)/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {getServerSession} from 'next-auth'
import { redirect } from 'next/navigation'
import {redirect} from 'next/navigation'
import {Suspense} from 'react'
import {authOptions} from '~/authOptions'
import {Repositories} from '~/components/dashboard/Repositories'
Expand All @@ -26,7 +26,7 @@ export default async function Page() {
id: true,
name: true,
createdAt: true,
customInstructions: true,
customInstructions: true
}
})

Expand Down
8 changes: 2 additions & 6 deletions app/dashboard/(base)/usage/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import React from 'react'

type Props = {}

export default function Usage({}: Props) {
return (
<div>Coming Soon...</div>
)
}
return <div>Coming Soon...</div>
}
4 changes: 2 additions & 2 deletions app/dashboard/Loader/PanelSkeletons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import {motion} from 'framer-motion'

export function PanelSkeletons({amount}: {amount: number}) {
return (
<div className='border-panel-border flex flex-col items-center gap-8'>
<div className='flex flex-col items-center gap-8 border-panel-border'>
{new Array(amount).fill(null).map((_scratch, i) => (
<motion.div
key={i}
className='bg-panel border-panel-border h-[200px] w-[400px] rounded-lg border-2'
className='h-[200px] w-[400px] rounded-lg border-2 border-panel-border bg-panel'
animate={{opacity: 0.8}}
transition={{
from: 1,
Expand Down
2 changes: 1 addition & 1 deletion app/dashboard/Loader/SpinnerLoader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export function SpinnerLoader() {
<div role='status'>
<svg
aria-hidden='true'
className='fill-grey h-6 w-6 animate-spin text-white'
className='h-6 w-6 animate-spin fill-grey text-white'
viewBox='0 0 100 101'
fill='none'
xmlns='http://www.w3.org/2000/svg'>
Expand Down
28 changes: 14 additions & 14 deletions app/dashboard/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
import {DashboardHeader} from '~/components/dashboard/Navigation/Header'
import {authOptions} from '~/authOptions'
import {getServerSession} from 'next-auth'
import {authOptions} from '~/authOptions'
import BackgroundGrid from '~/components/background-grid'
import {DashboardHeader} from '~/components/dashboard/Navigation/Header'

export default async function RootLayout({
children
}: {
children: React.ReactNode
}) {
const session = await getServerSession(authOptions)
const session = await getServerSession(authOptions)

return (
<div className='relative min-h-screen w-full bg-black px-8 text-white'>
<BackgroundGrid className='absolute opacity-40 h-full w-full left-0 right-0 z-0' />
{session && <DashboardHeader
return (
<div className='relative min-h-screen w-full bg-black px-8 text-white'>
<BackgroundGrid className='absolute left-0 right-0 z-0 h-full w-full opacity-40' />
{session && (
<DashboardHeader
session={session}
avatarUrl={session.user.image}
/>}
<div className='z-10 fixed w-full'>
{children}
</div>
</div>
)
}
/>
)}
<div className='fixed z-10 w-full'>{children}</div>
</div>
)
}
2 changes: 1 addition & 1 deletion app/dashboard/repo/[projectId]/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {getServerSession} from 'next-auth'
import {redirect} from 'next/navigation'
import {authOptions} from '~/authOptions'
import { RepoNavigation } from '~/components/dashboard/Navigation/RepoNavigation'
import {RepoNavigation} from '~/components/dashboard/Navigation/RepoNavigation'

export default async function Layout({
children
Expand Down
22 changes: 14 additions & 8 deletions app/dashboard/repo/[projectId]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {redirect} from 'next/navigation'
import {ChevronLeftIcon} from '@radix-ui/react-icons'
import {getServerSession} from 'next-auth'
import Link from 'next/link'
import {redirect} from 'next/navigation'
import {authOptions} from '~/authOptions'
import { ChevronLeftIcon } from '@radix-ui/react-icons'
import prisma from '~/prisma'
import Link from 'next/link'

export default async function Page({params}: {params: {projectId: string}}) {
const session = await getServerSession(authOptions)
Expand All @@ -14,12 +14,18 @@ export default async function Page({params}: {params: {projectId: string}}) {
})
return (
<div className='flex flex-col gap-4'>
<div className='border-b w-full pb-8 text-2xl font-medium xl:px-[4.25rem]'>
<span className='inline-flex items-center gap-2'><Link href="/dashboard"><ChevronLeftIcon width="20" height="20"/></Link> {project.name}</span>
</div>
<div className='flex flex-col xl:px-24'>
Coming soon...
<div className='w-full border-b pb-8 text-2xl font-medium xl:px-[4.25rem]'>
<span className='inline-flex items-center gap-2'>
<Link href='/dashboard'>
<ChevronLeftIcon
width='20'
height='20'
/>
</Link>{' '}
{project.name}
</span>
</div>
<div className='flex flex-col xl:px-24'>Coming soon...</div>
</div>
)
}
16 changes: 8 additions & 8 deletions components.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "new-york",
"aliases": {
"components": "~/components",
"utils": "~/utils"
},
"rsc": true,
"tsx": true,
"style": "new-york",
"tailwind": {
"baseColor": "gray",
"config": "tailwind.config.js",
"css": "~/styles/globals.css",
"baseColor": "gray",
"cssVariables": true,
"prefix": ""
},
"aliases": {
"components": "~/components",
"utils": "~/utils"
}
}
"tsx": true
}
2 changes: 1 addition & 1 deletion lib/components/background-grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,4 @@ export default function BackgroundGrid({
</g>
</svg>
)
}
}
4 changes: 2 additions & 2 deletions lib/components/command-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function CommandMenu() {
asChild
variant='outline'
onClick={() => setOpen(true)}
className='w-full pl-4 pr-2 md:w-80 hover:bg-zinc-900 text-zinc-300'>
className='w-full pl-4 pr-2 text-zinc-300 hover:bg-zinc-900 md:w-80'>
<div className='flex h-10 flex-row justify-between'>
<div className='flex flex-row gap-2'>
<SearchIcon className='my-auto h-4 w-4' />
Expand All @@ -39,7 +39,7 @@ export function CommandMenu() {
<CommandIcon width={12} />
</span>{' '}
<span className='flex h-[25px] w-[25px] items-center justify-center rounded bg-zinc-800 text-sm'>
{/* Attempts to center the K */}
{/* Attempts to center the K */}
<span className='mt-[0.05rem]'>K</span>
</span>
</kbd>
Expand Down
2 changes: 1 addition & 1 deletion lib/components/dashboard/Buttons/PrimaryButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import {SpinnerLoader} from 'app/dashboard/Loader'
import {motion} from 'framer-motion'
import {ReactNode} from 'react'
import {cn} from '~/utils'
import {SmallBody} from '../Text'
import { cn } from '~/utils'

export function PrimaryButton({
onClick,
Expand Down
2 changes: 1 addition & 1 deletion lib/components/dashboard/Buttons/SecondaryButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function SecondaryButton({
duration: 0.5
}
}}
className='bg-panel border-panel-border rounded-[10px] border-2 px-4 py-2'
className='rounded-[10px] border-2 border-panel-border bg-panel px-4 py-2'
onClick={onClick}>
<SmallBody>{children}</SmallBody>
</motion.button>
Expand Down
2 changes: 1 addition & 1 deletion lib/components/dashboard/Input/TextArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export function TextArea({
}) {
return (
<textarea
className='bg-panel border-panel-border rounded-lg border-2 p-2 text-white focus:outline-none'
className='rounded-lg border-2 border-panel-border bg-panel p-2 text-white focus:outline-none'
value={value}
onChange={e => onTextChange((e.target as any).value)}></textarea>
)
Expand Down
52 changes: 32 additions & 20 deletions lib/components/dashboard/Instructions/Instructions.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,33 @@
'use client'

import {type Instruction} from '@prisma/client'
import {ArrowTopRightIcon} from '@radix-ui/react-icons'
import {PenSquare} from 'lucide-react'
import Link from 'next/link'
import {useState} from 'react'
import {toast} from 'sonner'
import { buttonVariants } from '~/components/ui/button'
import {updateInstruction} from '~/actions/instructions'
import {PrimaryButton, SecondaryButton} from '../Buttons'
import {Button, buttonVariants} from '~/components/ui/button'
import {cn} from '~/utils'
import {PrimaryButton} from '../Buttons'
import {TextArea} from '../Input'
import {MediumBody, SmallHeading, Subtext} from '../Text'
import { ArrowTopRightIcon } from '@radix-ui/react-icons'
import { cn } from '~/utils'
import { Button } from '~/components/ui/button'
import {MediumBody, Subtext} from '../Text'

export function Instructions({instructions}: {instructions: Instruction[]}) {
return (
<>
{instructions.map((instruction, i) => (
<>
<Instruction
instruction={instruction}
index={i}
key={instruction.id}
/>
<div className={cn('w-full bg-zinc-900 max-w-2xl h-0.5', i+1 === instructions.length && "hidden")}></div>
<Instruction
instruction={instruction}
index={i}
key={instruction.id}
/>
<div
className={cn(
'h-0.5 w-full max-w-2xl bg-zinc-900',
i + 1 === instructions.length && 'hidden'
)}></div>
</>
))}
</>
Expand All @@ -43,26 +46,33 @@ function Instruction({
const [content, setContent] = useState(instruction.content)

return (
<div className='bg-panel border-panel-border flex flex-col gap-4 rounded-lg border-2 p-8 w-full max-w-2xl'>
<div className='flex justify-between items-center'>
<div className='rounded-sm text bg-zinc-800 text-zinc-500 px-2.5 justify-center items-center flex'>{index+1}</div>
<div className='flex w-full max-w-2xl flex-col gap-4 rounded-lg border-2 border-panel-border bg-panel p-8'>
<div className='flex items-center justify-between'>
<div className='text flex items-center justify-center rounded-sm bg-zinc-800 px-2.5 text-zinc-500'>
{index + 1}
</div>
<Subtext>
<Link
href={instruction.githubCommentLink}
target='_blank'
className='bg-zinc-800 px-2.5 py-0.5 rounded-sm inline-flex items-center gap-0.5'>
className='inline-flex items-center gap-0.5 rounded-sm bg-zinc-800 px-2.5 py-0.5'>
{instruction.creatorUsername}
<ArrowTopRightIcon/>
<ArrowTopRightIcon />
</Link>
</Subtext>
</div>
{!isEditing && (
<div className='flex flex-col gap-2'>
<MediumBody>&quot;{content}&quot;</MediumBody>
<div
className='cursor-pointer flex justify-end w-full'
className='flex w-full cursor-pointer justify-end'
onClick={() => setIsEditing(true)}>
<Button size='sm' variant='outline' className='inline-flex gap-2'>Edit <PenSquare width={16} /></Button>
<Button
size='sm'
variant='outline'
className='inline-flex gap-2'>
Edit <PenSquare width={16} />
</Button>
</div>
</div>
)}
Expand All @@ -75,7 +85,9 @@ function Instruction({
)}
{isEditing && (
<div className='flex flex-row items-center justify-between'>
<Button size='sm' variant='outline'
<Button
size='sm'
variant='outline'
onClick={() => {
setContent(instruction.content)
setIsEditing(false)
Expand Down
15 changes: 9 additions & 6 deletions lib/components/dashboard/Landing/Landing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@

import {Github} from 'lucide-react'
import {signIn} from 'next-auth/react'
import { Button } from '~/components/ui/button'
import {Button} from '~/components/ui/button'

export function Landing() {
return (
<div className='flex h-screen w-full items-center justify-center'>
<div className='flex flex-col justify-center items-center gap-3 w-full max-w-xs'>
<div className='flex w-full max-w-xs flex-col items-center justify-center gap-3'>
<span className='text-sm'>Lets get Started!</span>
<Button className="w-full py-5" variant='outline' onClick={() => signIn('github', {callbackUrl: '/dashboard'})}>
<Github className='mr-2 inline' />
Sign in
</Button>
<Button
className='w-full py-5'
variant='outline'
onClick={() => signIn('github', {callbackUrl: '/dashboard'})}>
<Github className='mr-2 inline' />
Sign in
</Button>
</div>
</div>
)
Expand Down
Loading

0 comments on commit 6175387

Please sign in to comment.