-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
1,113 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
import { type NextApiRequest, type NextApiResponse } from "next"; | ||
|
||
import { type Session } from "@kampus/next-auth"; | ||
|
||
import { type DataLoaders } from "~/loaders"; | ||
|
||
export interface KampusGQLContext { | ||
req: NextApiRequest; | ||
res: NextApiResponse; | ||
loaders: DataLoaders; | ||
session: Session | null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# update with the url after running `npm run dev` under `apps/gql` | ||
NEXT_PUBLIC_GQL_URL=http://gql.localhost.kamp.us:3001/graphql | ||
NEXTAUTH_URL=http://localhost:3000/pasaport |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,27 @@ | ||
import Link from "next/link"; | ||
|
||
import { getServerSession } from "@kampus/next-auth"; | ||
|
||
import { PasaportSignIn, PasaportSignOut } from "~/features/pasaport"; | ||
|
||
export default async function Home() { | ||
const session = await getServerSession(); | ||
|
||
return ( | ||
<main className="flex min-h-screen flex-col items-center justify-between p-24"> | ||
selam kampus | ||
{session ? ( | ||
<Link href="/pasaport/signout">logout</Link> | ||
) : ( | ||
<Link href="/pasaport/signin">login</Link> | ||
)} | ||
{session ? <PasaportSignOut /> : <PasaportSignIn />} | ||
<pre>{JSON.stringify(session, null, 2)}</pre> | ||
</main> | ||
); | ||
} | ||
|
||
const IateeComponent = () => { | ||
const [count, setCount] = useState(0); | ||
|
||
useEffect(() => { | ||
setInterval(() => { | ||
setCount(count + 1) | ||
}, 1000) | ||
}, [count]) | ||
|
||
return <div>{count}</div>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,83 @@ | ||
"use client"; | ||
|
||
import NextLink from "next/link"; | ||
import { graphql, useFragment } from "react-relay"; | ||
|
||
import { cn } from "@kampus/ui-next/utils"; | ||
|
||
import { MoreOptionsDropdown } from "./MoreOptions"; | ||
import { TimeAgo } from "~/../../packages/ui"; | ||
import { type PostItem_post$key } from "./__generated__/PostItem_post.graphql"; | ||
import { UpvoteButton } from "./PostUpvoteButton"; | ||
|
||
type Post = { | ||
__typename?: "PanoPost"; | ||
content: string; | ||
createdAt: string; | ||
id: string; | ||
owner: string; | ||
title: string; | ||
url: string; | ||
}; | ||
|
||
type PostItemProps = { | ||
post: Post; | ||
showContent?: boolean; | ||
}; | ||
// import { MoreOptionsDropdown } from "./MoreOptions"; | ||
|
||
interface LinkProps { | ||
href: string; | ||
title: string; | ||
children: string; | ||
className?: string; | ||
} | ||
|
||
const Link = ({ href, title, className }: LinkProps) => { | ||
const Link = ({ href, children: title, className }: LinkProps) => { | ||
return ( | ||
<NextLink className={cn("text-muted-foreground hover:underline", className)} href={href}> | ||
<NextLink className={cn("hover:underline", className)} href={href}> | ||
{title} | ||
</NextLink> | ||
); | ||
}; | ||
|
||
const usePanoPostFragment = (key: PostItem_post$key | null) => | ||
useFragment( | ||
graphql` | ||
fragment PostItem_post on PanoPost { | ||
id | ||
title | ||
content | ||
url | ||
createdAt | ||
id | ||
site | ||
owner { | ||
username | ||
} | ||
} | ||
`, | ||
key | ||
); | ||
|
||
interface PostItemProps { | ||
post: PostItem_post$key; | ||
showContent?: boolean; | ||
} | ||
|
||
export const PostItem = (props: PostItemProps) => { | ||
const post = usePanoPostFragment(props.post); | ||
|
||
if (!post) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<div className="mr-1 flex h-full gap-1 border-l-2"> | ||
<div className="ml-1 flex h-full"> | ||
<UpvoteButton upvoteCount={5} isUpvoted={false} disabled={false} isVoting={false} /> | ||
</div> | ||
<section className="flex h-full items-center gap-2 rounded"> | ||
<UpvoteButton upvoteCount={5} isUpvoted={false} disabled={false} isVoting={false} /> | ||
|
||
<div className="flex w-full flex-col justify-center"> | ||
<div className="flex items-center gap-1 align-baseline"> | ||
<Link title={props.post.title} href={props.post.url} /> | ||
<Link className="text-sm" title="wow.sh" href={props.post.url} /> | ||
<Link className="font-semibold" href={post.url ?? ""}> | ||
{post.title} | ||
</Link> | ||
<Link className="text-sm" href={post.url ?? ""}> | ||
{post.site ?? ""} | ||
</Link> | ||
</div> | ||
<div className="flex items-center gap-1 text-sm"> | ||
<div>@{props.post.owner} |</div> | ||
<div>{<Link title="0 yorum" href={`/pano/post/${props.post.id}/`} />} |</div> | ||
<div>{props.post.createdAt} |</div> | ||
<MoreOptionsDropdown post={props.post} shareUrl={props.post.url} /> | ||
<div>@{post.owner?.username} |</div> | ||
<div> | ||
<Link href={`/pano/post/${post.id}`}>0 yorum</Link> | | ||
</div> | ||
<TimeAgo date={new Date(post.createdAt as string)} /> | ||
</div> | ||
</div> | ||
</div> | ||
</section> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.