-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
17 changed files
with
615 additions
and
496 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,67 @@ | ||
"use client"; | ||
'use client' | ||
|
||
import { ReactNode, useCallback } from "react"; | ||
import GistLayout from "./layout-ui"; | ||
import { useMe } from "@/lib/queries/user.queries"; | ||
import { toast, useToast } from "@/components/shadcn/use-toast"; | ||
import { useCreateGist } from "@/lib/queries/gists.queries"; | ||
import { useCreateOrg } from "@/lib/queries/orgs.queries"; | ||
import { ReactNode, useCallback } from 'react' | ||
import GistLayout from './layout-ui' | ||
import { useMe } from '@/lib/queries/user.queries' | ||
import { useToast } from '@/components/shadcn/use-toast' | ||
import { useCreateGist } from '@/lib/queries/gists.queries' | ||
import { useCreateOrg } from '@/lib/queries/orgs.queries' | ||
|
||
export default function GistLayoutFeature({ | ||
children, | ||
}: { | ||
children: ReactNode; | ||
}) { | ||
const { data } = useMe(); | ||
const { toast } = useToast(); | ||
export default function GistLayoutFeature({ children }: { children: ReactNode }) { | ||
const { data } = useMe() | ||
const { toast } = useToast() | ||
const { mutate: createGist } = useCreateGist({ | ||
onSuccess: () => { | ||
toast({ | ||
title: "Gist Created", | ||
description: "Your gist has been created successfully", | ||
}); | ||
title: 'Gist Created', | ||
description: 'Your gist has been created successfully', | ||
}) | ||
}, | ||
}); | ||
}) | ||
|
||
const { mutate: createTeam } = useCreateOrg({ | ||
onSuccess: () => { | ||
toast({ | ||
title: "Team Created", | ||
description: "Your team has been created successfully", | ||
}); | ||
title: 'Team Created', | ||
description: 'Your team has been created successfully', | ||
}) | ||
}, | ||
}); | ||
}) | ||
|
||
const onMyGistsClick = () => { | ||
console.log("My Gists clicked"); | ||
}; | ||
console.log('My Gists clicked') | ||
} | ||
|
||
const onCreateTeamClick = useCallback( | ||
(name: string) => { | ||
createTeam(name); | ||
console.log("Creating tea with name:", name); | ||
createTeam(name) | ||
console.log('Creating team with name:', name) | ||
}, | ||
[toast, createTeam], | ||
); | ||
[toast, createTeam] | ||
) | ||
|
||
const onLogoutClick = () => { | ||
console.log('/logout') | ||
} | ||
|
||
const onCreateGistClick = (name: string, content: string) => { | ||
console.log(`Creating gist with name: ${name} \nand content: ${content}`); | ||
console.log(`Creating gist with name: ${name} \nand content: ${content}`) | ||
createGist({ | ||
content, | ||
name, | ||
}); | ||
}; | ||
}) | ||
} | ||
|
||
return ( | ||
<GistLayout | ||
username={data?.name ?? ""} | ||
avatar={data?.picture ?? ""} | ||
onLogoutClick={onLogoutClick} | ||
username={data?.name ?? ''} | ||
avatar={data?.picture ?? ''} | ||
onCreateTeamClick={onCreateTeamClick} | ||
onMyGistsClick={onMyGistsClick} | ||
onCreateGistClick={onCreateGistClick} | ||
> | ||
{children} | ||
</GistLayout> | ||
); | ||
) | ||
} |
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
Oops, something went wrong.