-
Notifications
You must be signed in to change notification settings - Fork 461
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add credits page in team settings (chakra) (#4458)
## Problem solved Short description of the bug fixed or feature added <!-- start pr-codex --> --- ## PR-Codex overview The focus of this PR is to refactor the settings page for gas credits, adding a new component and improving the layout. ### Detailed summary - Added a new component `SettingsGasCreditsPage` for gas credits settings - Updated the layout of the gas credits settings page - Removed unused imports and components - Renamed `SettingsGasCreditsPage` to `Page` and updated references > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
- Loading branch information
Showing
5 changed files
with
61 additions
and
54 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
apps/dashboard/src/app/team/[team_slug]/(team)/~/settings/credits/SettingsCreditsPage.tsx
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,40 @@ | ||
"use client"; | ||
|
||
import { Spinner } from "@/components/ui/Spinner/Spinner"; | ||
import { useLoggedInUser } from "@3rdweb-sdk/react/hooks/useLoggedInUser"; | ||
import { Flex } from "@chakra-ui/react"; | ||
import { ApplyForOpCreditsModal } from "components/onboarding/ApplyForOpCreditsModal"; | ||
import { Heading, LinkButton } from "tw-components"; | ||
|
||
export const SettingsGasCreditsPage = () => { | ||
const { isLoading } = useLoggedInUser(); | ||
|
||
if (isLoading) { | ||
return ( | ||
<div className="grid w-full min-h-[400px] place-items-center"> | ||
<Spinner className="size-10" /> | ||
</div> | ||
); | ||
} | ||
|
||
return ( | ||
<Flex flexDir="column" gap={8}> | ||
<Flex direction="row" gap={4} align="center"> | ||
<Heading size="title.lg" as="h1"> | ||
Apply to the Optimism Superchain App Accelerator | ||
</Heading> | ||
<LinkButton | ||
display={{ base: "none", md: "inherit" }} | ||
isExternal | ||
href="https://blog.thirdweb.com/accelerating-the-superchain-with-optimism/" | ||
size="sm" | ||
variant="outline" | ||
> | ||
Learn More | ||
</LinkButton> | ||
</Flex> | ||
|
||
<ApplyForOpCreditsModal /> | ||
</Flex> | ||
); | ||
}; |
11 changes: 6 additions & 5 deletions
11
apps/dashboard/src/app/team/[team_slug]/(team)/~/settings/credits/page.tsx
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,9 +1,10 @@ | ||
import { ChakraProviderSetup } from "@/components/ChakraProviderSetup"; | ||
import { SettingsGasCreditsPage } from "./SettingsCreditsPage"; | ||
|
||
export default function Page() { | ||
return ( | ||
<div className="h-full py-6 container flex items-center justify-center"> | ||
<h1 className="text-4xl tracking-tighter text-muted-foreground"> | ||
Credits Settings | ||
</h1> | ||
</div> | ||
<ChakraProviderSetup> | ||
<SettingsGasCreditsPage /> | ||
</ChakraProviderSetup> | ||
); | ||
} |
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
46 changes: 7 additions & 39 deletions
46
apps/dashboard/src/pages/dashboard/settings/gas-credits.tsx
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,53 +1,21 @@ | ||
import { Spinner } from "@/components/ui/Spinner/Spinner"; | ||
import { useLoggedInUser } from "@3rdweb-sdk/react/hooks/useLoggedInUser"; | ||
import { Flex } from "@chakra-ui/react"; | ||
import { AppLayout } from "components/app-layouts/app"; | ||
import { ApplyForOpCreditsModal } from "components/onboarding/ApplyForOpCreditsModal"; | ||
import { SettingsSidebar } from "core-ui/sidebar/settings"; | ||
import { PageId } from "page-id"; | ||
import { Heading, LinkButton } from "tw-components"; | ||
import {} from "tw-components"; | ||
import type { ThirdwebNextPage } from "utils/types"; | ||
import { SettingsGasCreditsPage } from "../../../app/team/[team_slug]/(team)/~/settings/credits/SettingsCreditsPage"; | ||
|
||
const SettingsGasCreditsPage: ThirdwebNextPage = () => { | ||
const { isLoading } = useLoggedInUser(); | ||
|
||
if (isLoading) { | ||
return ( | ||
<div className="grid w-full place-items-center"> | ||
<Spinner className="size-14" /> | ||
</div> | ||
); | ||
} | ||
|
||
return ( | ||
<Flex flexDir="column" gap={8}> | ||
<Flex direction="row" gap={4} align="center"> | ||
<Heading size="title.lg" as="h1"> | ||
Apply to the Optimism Superchain App Accelerator | ||
</Heading> | ||
<LinkButton | ||
display={{ base: "none", md: "inherit" }} | ||
isExternal | ||
href="https://blog.thirdweb.com/accelerating-the-superchain-with-optimism/" | ||
size="sm" | ||
variant="outline" | ||
> | ||
Learn More | ||
</LinkButton> | ||
</Flex> | ||
|
||
<ApplyForOpCreditsModal /> | ||
</Flex> | ||
); | ||
const Page: ThirdwebNextPage = () => { | ||
return <SettingsGasCreditsPage />; | ||
}; | ||
|
||
SettingsGasCreditsPage.getLayout = (page, props) => ( | ||
Page.getLayout = (page, props) => ( | ||
<AppLayout {...props} hasSidebar={true}> | ||
<SettingsSidebar activePage="gas-credits" /> | ||
{page} | ||
</AppLayout> | ||
); | ||
|
||
SettingsGasCreditsPage.pageId = PageId.SettingsUsage; | ||
Page.pageId = PageId.SettingsUsage; | ||
|
||
export default SettingsGasCreditsPage; | ||
export default Page; |