-
Notifications
You must be signed in to change notification settings - Fork 0
feat: remove react-query in favor of server actions #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
a6dec20
checkpoint: user-list user-details (no cards)
lorenzocorallo 0bf1c70
checkpoint
lorenzocorallo d93aa85
checkpoint
lorenzocorallo bbb5e5f
checkpoint: user-details components
lorenzocorallo 0919483
checkpoint: grants
lorenzocorallo d4e9ee0
checkpoint: azure
lorenzocorallo a39bd0e
fix: button as render
lorenzocorallo 72a85b3
checkpoint: account
lorenzocorallo f264eac
checkpoint: more grants
lorenzocorallo 4b3272d
fix: typos
lorenzocorallo bdbef68
checkpoint: groups
lorenzocorallo 552ed5f
checkpoint: group row hide toggle
lorenzocorallo 9e476e9
feat: remove react-query
lorenzocorallo b25a5ce
fix: remove exposure of tRPC
lorenzocorallo 99ec56d
feat: add count for groups and users lists
lorenzocorallo e3a4eaa
review
lorenzocorallo 1fc874c
fix: avoid double query in groups
lorenzocorallo 91d3b7e
feat: put role check in actions
lorenzocorallo 995237c
fix: pending states
lorenzocorallo 437d9df
fix: update auditlog query
lorenzocorallo 615a092
fix: better data fetching
lorenzocorallo 2139007
fix: old update state
lorenzocorallo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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,27 +1,17 @@ | ||
| "use client" | ||
| import { useQuery } from "@tanstack/react-query" | ||
| import { useSession } from "@/lib/auth" | ||
| import { useTRPC } from "@/lib/trpc/client" | ||
| import { getUserRoles } from "@/server/actions/users" | ||
| import { getServerSession } from "@/server/auth" | ||
|
|
||
| export function Telegram() { | ||
| const { data: session, isPending } = useSession() | ||
| if (isPending || !session) return null | ||
| export async function Telegram() { | ||
| const { data } = await getServerSession() | ||
| if (!data || !data.user.telegramId) return null | ||
|
|
||
| const { user } = session | ||
| if (!user.telegramUsername || !user.telegramId) return null | ||
| const { roles } = await getUserRoles(data.user.telegramId) | ||
|
lorenzocorallo marked this conversation as resolved.
|
||
| const length = roles?.length ?? 0 | ||
|
|
||
| return <ShowTelegram username={user.telegramUsername} userId={user.telegramId} /> | ||
| } | ||
|
|
||
| function ShowTelegram({ username, userId }: { username: string; userId: number }) { | ||
| const trpc = useTRPC() | ||
| const { data, isLoading } = useQuery(trpc.tg.permissions.getRoles.queryOptions({ userId })) | ||
| return ( | ||
| <> | ||
| <span>@{username}</span> | ||
| {!isLoading && data?.roles?.length && ( | ||
| <span className="text-foreground/30 text-xs">(roles: {data.roles.join(", ")})</span> | ||
| )} | ||
| <span>{data.user.telegramUsername ? `@${data.user.telegramUsername}` : data.user.id}</span> | ||
| {roles && length > 0 && <span className="text-foreground/30 text-xs">(roles: {roles.join(", ")})</span>} | ||
| </> | ||
| ) | ||
| } | ||
This file contains hidden or 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 hidden or 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 hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.