Skip to content

Dashboard: file organization refactor (no code change) #7410

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 1 commit into from
Jun 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
14 changes: 4 additions & 10 deletions apps/dashboard/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ module.exports = {
"plugin:storybook/recommended",
],
overrides: [
// disable restricted imports in tw-components
// disable restricted imports in chakra
{
files: "src/tw-components/**/*",
files: "src/chakra/**/*",
rules: {
"no-restricted-imports": ["off"],
},
Expand Down Expand Up @@ -92,7 +92,7 @@ module.exports = {
{
paths: [
{
// these are provided by tw-components, so we don't want to import them from chakra directly
// these are provided by chakra folder, so we don't want to import them from chakra directly
importNames: [
"Card",
"Button",
Expand Down Expand Up @@ -127,7 +127,7 @@ module.exports = {
"StackProps",
],
message:
'Use the equivalent component from "tw-components" instead.',
'import component from "chakra" folder instead if you have to use chakra component, But use shadcn component otherwise',
name: "@chakra-ui/react",
},
{
Expand All @@ -151,12 +151,6 @@ module.exports = {
'Use `import { useDashboardRouter } from "@/lib/DashboardRouter";` instead',
name: "next/navigation",
},
{
importNames: ["Link", "Table", "Sidebar"],
message:
'This is likely a mistake. If you really want to import this - postfix the imported name with Icon. Example - "LinkIcon"',
name: "lucide-react",
},
{
message:
'Import "posthog-js" directly only within the analytics helpers ("src/@/analytics/*"). Use the exported helpers from "@/analytics/track" elsewhere.',
Expand Down
6 changes: 3 additions & 3 deletions apps/dashboard/knip.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"$schema": "https://unpkg.com/knip@5/schema.json",
"ignore": [
"src/@/components/ui/**",
"src/components/notices/AnnouncementBanner.tsx",
"src/components/cmd-k-search/index.tsx",
"src/lib/search.ts"
"src/@/components/misc/AnnouncementBanner.tsx",
"src/@/components/cmd-k-search/index.tsx",
"src/@/lib/search.ts"
],
"ignoreBinaries": ["only-allow"],
"ignoreDependencies": [
Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
"dev": "next dev --turbopack",
"fix": "biome check ./src --fix && eslint ./src --fix",
"format": "biome format ./src --write",
"gen:theme-typings": "chakra-cli tokens src/theme/index.ts",
"gen:theme-typings": "chakra-cli tokens src/chakra/theme/index.ts",
"knip": "knip",
"lint": "biome check ./src && knip && eslint ./src",
"playwright": "playwright test",
Expand Down
4 changes: 2 additions & 2 deletions apps/dashboard/src/@/actions/acceptInvite.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use server";

import { getAuthToken } from "../../app/(app)/api/lib/getAuthToken";
import { NEXT_PUBLIC_THIRDWEB_API_HOST } from "../constants/public-envs";
import { getAuthToken } from "@/api/auth-token";
import { NEXT_PUBLIC_THIRDWEB_API_HOST } from "@/constants/public-envs";

export async function acceptInvite(options: {
teamId: string;
Expand Down
4 changes: 2 additions & 2 deletions apps/dashboard/src/@/actions/billing.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use server";

import { getAuthToken } from "../../app/(app)/api/lib/getAuthToken";
import { NEXT_PUBLIC_THIRDWEB_API_HOST } from "../constants/public-envs";
import { getAuthToken } from "@/api/auth-token";
import { NEXT_PUBLIC_THIRDWEB_API_HOST } from "@/constants/public-envs";

export async function reSubscribePlan(options: {
teamId: string;
Expand Down
4 changes: 2 additions & 2 deletions apps/dashboard/src/@/actions/confirmEmail.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use server";

import { getAuthToken } from "../../app/(app)/api/lib/getAuthToken";
import { NEXT_PUBLIC_THIRDWEB_API_HOST } from "../constants/public-envs";
import { getAuthToken } from "@/api/auth-token";
import { NEXT_PUBLIC_THIRDWEB_API_HOST } from "@/constants/public-envs";

export async function confirmEmailWithOTP(otp: string) {
const token = await getAuthToken();
Expand Down
4 changes: 2 additions & 2 deletions apps/dashboard/src/@/actions/createTeam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import "server-only";
// biome-ignore lint/style/useNodejsImportProtocol: breaks storybook if it's `node:` prefixed
import { randomBytes } from "crypto";
import { format } from "date-fns";
import { getAuthToken } from "@/api/auth-token";
import type { Team } from "@/api/team";
import { getAuthToken } from "../../app/(app)/api/lib/getAuthToken";
import { NEXT_PUBLIC_THIRDWEB_API_HOST } from "../constants/public-envs";
import { NEXT_PUBLIC_THIRDWEB_API_HOST } from "@/constants/public-envs";

export async function createTeam(options?: { name?: string; slug?: string }) {
const token = await getAuthToken();
Expand Down
4 changes: 2 additions & 2 deletions apps/dashboard/src/@/actions/deleteTeam.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use server";
import "server-only";
import { getAuthToken } from "../../app/(app)/api/lib/getAuthToken";
import { NEXT_PUBLIC_THIRDWEB_API_HOST } from "../constants/public-envs";
import { getAuthToken } from "@/api/auth-token";
import { NEXT_PUBLIC_THIRDWEB_API_HOST } from "@/constants/public-envs";

export async function deleteTeam(options: { teamId: string }) {
const token = await getAuthToken();
Expand Down
6 changes: 3 additions & 3 deletions apps/dashboard/src/@/actions/getBalancesFromMoralis.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"use server";
import { defineDashboardChain } from "lib/defineDashboardChain";
import { isAddress, toTokens, ZERO_ADDRESS } from "thirdweb";
import { getWalletBalance } from "thirdweb/wallets";
import { MORALIS_API_KEY } from "../constants/server-envs";
import { serverThirdwebClient } from "../constants/thirdweb-client.server";
import { MORALIS_API_KEY } from "@/constants/server-envs";
import { serverThirdwebClient } from "@/constants/thirdweb-client.server";
import { defineDashboardChain } from "@/lib/defineDashboardChain";

type BalanceQueryResponse = Array<{
balance: string;
Expand Down
16 changes: 8 additions & 8 deletions apps/dashboard/src/@/actions/getWalletNFTs.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
"use server";

import { NEXT_PUBLIC_DASHBOARD_CLIENT_ID } from "@/constants/public-envs";
import { MORALIS_API_KEY } from "@/constants/server-envs";
import {
generateAlchemyUrl,
transformAlchemyResponseToNFT,
} from "lib/wallet/nfts/alchemy";
} from "@/lib/wallet/nfts/alchemy";
import {
generateMoralisUrl,
transformMoralisResponseToNFT,
} from "lib/wallet/nfts/moralis";
import type { WalletNFT } from "lib/wallet/nfts/types";
import { getVercelEnv } from "../../lib/vercel-utils";
import { isAlchemySupported } from "../../lib/wallet/nfts/isAlchemySupported";
import { isMoralisSupported } from "../../lib/wallet/nfts/isMoralisSupported";
import { NEXT_PUBLIC_DASHBOARD_CLIENT_ID } from "../constants/public-envs";
import { MORALIS_API_KEY } from "../constants/server-envs";
} from "@/lib/wallet/nfts/moralis";
import type { WalletNFT } from "@/lib/wallet/nfts/types";
import { getVercelEnv } from "@/utils/vercel";
import { isAlchemySupported } from "../lib/wallet/nfts/isAlchemySupported";
import { isMoralisSupported } from "../lib/wallet/nfts/isMoralisSupported";

type WalletNFTApiReturn =
| { result: WalletNFT[]; error?: undefined }
Expand Down
6 changes: 3 additions & 3 deletions apps/dashboard/src/@/actions/proxies.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"use server";

import { getAuthToken } from "../../app/(app)/api/lib/getAuthToken";
import { getAuthToken } from "@/api/auth-token";
import {
NEXT_PUBLIC_ENGINE_CLOUD_URL,
NEXT_PUBLIC_THIRDWEB_API_HOST,
} from "../constants/public-envs";
import { ANALYTICS_SERVICE_URL } from "../constants/server-envs";
} from "@/constants/public-envs";
import { ANALYTICS_SERVICE_URL } from "@/constants/server-envs";

type ProxyActionParams = {
pathname: string;
Expand Down
4 changes: 2 additions & 2 deletions apps/dashboard/src/@/actions/sendTeamInvite.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use server";

import { getAuthToken } from "../../app/(app)/api/lib/getAuthToken";
import { NEXT_PUBLIC_THIRDWEB_API_HOST } from "../constants/public-envs";
import { getAuthToken } from "@/api/auth-token";
import { NEXT_PUBLIC_THIRDWEB_API_HOST } from "@/constants/public-envs";

export async function sendTeamInvites(options: {
teamId: string;
Expand Down
4 changes: 2 additions & 2 deletions apps/dashboard/src/@/actions/stripe-actions.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import "server-only";

import Stripe from "stripe";
import type { Team } from "../api/team";
import { STRIPE_SECRET_KEY } from "../constants/server-envs";
import type { Team } from "@/api/team";
import { STRIPE_SECRET_KEY } from "@/constants/server-envs";

let existingStripe: Stripe | undefined;

Expand Down
4 changes: 2 additions & 2 deletions apps/dashboard/src/@/actions/updateAccount.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use server";
import { getAuthToken } from "../../app/(app)/api/lib/getAuthToken";
import { NEXT_PUBLIC_THIRDWEB_API_HOST } from "../constants/public-envs";
import { getAuthToken } from "@/api/auth-token";
import { NEXT_PUBLIC_THIRDWEB_API_HOST } from "@/constants/public-envs";

export async function updateAccount(values: {
name?: string;
Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/src/@/analytics/report.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import posthog from "posthog-js";

import type { Team } from "../api/team";
import type { Team } from "@/api/team";

// ----------------------------
// CONTRACTS
Expand Down
6 changes: 3 additions & 3 deletions apps/dashboard/src/@/api/analytics.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import "server-only";

import { ANALYTICS_SERVICE_URL } from "@/constants/server-envs";
import type {
AnalyticsQueryParams,
EcosystemWalletStats,
Expand All @@ -12,9 +13,8 @@ import type {
UserOpStats,
WalletStats,
WalletUserStats,
} from "types/analytics";
import { getAuthToken } from "../../app/(app)/api/lib/getAuthToken";
import { ANALYTICS_SERVICE_URL } from "../constants/server-envs";
} from "@/types/analytics";
import { getAuthToken } from "./auth-token";
import { getChains } from "./chain";

async function fetchAnalytics(
Expand Down
4 changes: 2 additions & 2 deletions apps/dashboard/src/@/api/audit-log.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"use server";

import "server-only";
import { getAuthToken } from "../../app/(app)/api/lib/getAuthToken";
import { NEXT_PUBLIC_THIRDWEB_API_HOST } from "../constants/public-envs";
import { NEXT_PUBLIC_THIRDWEB_API_HOST } from "@/constants/public-envs";
import { getAuthToken } from "./auth-token";

export type AuditLogEntry = {
who: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { LAST_USED_TEAM_ID } from "constants/cookies";
import { cookies } from "next/headers";
import { COOKIE_ACTIVE_ACCOUNT, COOKIE_PREFIX_TOKEN } from "@/constants/cookie";
import { LAST_USED_TEAM_ID } from "@/constants/cookies";
import { getClientThirdwebClient } from "@/constants/thirdweb-client.client";

export async function getAuthToken() {
Expand Down
6 changes: 3 additions & 3 deletions apps/dashboard/src/@/api/chain.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import "server-only";
import type { ChainMetadata } from "thirdweb/chains";
import type { ChainService } from "../../app/(app)/(dashboard)/(chain)/types/chain";
import { NEXT_PUBLIC_THIRDWEB_API_HOST } from "../constants/public-envs";
import { API_SERVER_SECRET } from "../constants/server-envs";
import { NEXT_PUBLIC_THIRDWEB_API_HOST } from "@/constants/public-envs";
import { API_SERVER_SECRET } from "@/constants/server-envs";
import type { ChainService } from "@/types/chain";

export async function getGasSponsoredChains() {
if (!API_SERVER_SECRET) {
Expand Down
4 changes: 2 additions & 2 deletions apps/dashboard/src/@/api/dedicated-support.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"use server";
import "server-only";

import { getAuthToken } from "../../app/(app)/api/lib/getAuthToken";
import { NEXT_PUBLIC_THIRDWEB_API_HOST } from "../constants/public-envs";
import { NEXT_PUBLIC_THIRDWEB_API_HOST } from "@/constants/public-envs";
import { getAuthToken } from "./auth-token";

export async function createDedicatedSupportChannel(
teamIdOrSlug: string,
Expand Down
4 changes: 2 additions & 2 deletions apps/dashboard/src/@/api/insight/webhooks.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
"use server";

import { getAuthToken } from "app/(app)/api/lib/getAuthToken";
import { THIRDWEB_INSIGHT_API_DOMAIN } from "constants/urls";
import { getAuthToken } from "@/api/auth-token";
import { THIRDWEB_INSIGHT_API_DOMAIN } from "@/constants/urls";

export interface WebhookResponse {
id: string;
Expand Down
4 changes: 2 additions & 2 deletions apps/dashboard/src/@/api/linked-wallets.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getAuthToken } from "../../app/(app)/api/lib/getAuthToken";
import { NEXT_PUBLIC_THIRDWEB_API_HOST } from "../constants/public-envs";
import { NEXT_PUBLIC_THIRDWEB_API_HOST } from "@/constants/public-envs";
import { getAuthToken } from "./auth-token";

export type LinkedWallet = {
createdAt: string;
Expand Down
4 changes: 2 additions & 2 deletions apps/dashboard/src/@/api/notifications.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"use server";

import "server-only";
import { getAuthToken } from "../../app/(app)/api/lib/getAuthToken";
import { NEXT_PUBLIC_THIRDWEB_API_HOST } from "../constants/public-envs";
import { NEXT_PUBLIC_THIRDWEB_API_HOST } from "@/constants/public-envs";
import { getAuthToken } from "./auth-token";

export type Notification = {
id: string;
Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/src/@/api/projects.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import "server-only";
import type { ProjectResponse } from "@thirdweb-dev/service-utils";
import { NEXT_PUBLIC_THIRDWEB_API_HOST } from "@/constants/public-envs";
import { getAuthToken } from "../../app/(app)/api/lib/getAuthToken";
import { getAuthToken } from "./auth-token";

export type Project = ProjectResponse;

Expand Down
4 changes: 2 additions & 2 deletions apps/dashboard/src/@/api/sms.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import "server-only";
import { NEXT_PUBLIC_THIRDWEB_API_HOST } from "../constants/public-envs";
import { API_SERVER_SECRET } from "../constants/server-envs";
import { NEXT_PUBLIC_THIRDWEB_API_HOST } from "@/constants/public-envs";
import { API_SERVER_SECRET } from "@/constants/server-envs";

export type SMSCountryTiers = {
tier1: string[];
Expand Down
4 changes: 2 additions & 2 deletions apps/dashboard/src/@/api/team-invites.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getAuthToken } from "../../app/(app)/api/lib/getAuthToken";
import { NEXT_PUBLIC_THIRDWEB_API_HOST } from "../constants/public-envs";
import { NEXT_PUBLIC_THIRDWEB_API_HOST } from "@/constants/public-envs";
import { getAuthToken } from "./auth-token";

export type TeamInvite = {
id: string;
Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/src/@/api/team-members.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import "server-only";
import { NEXT_PUBLIC_THIRDWEB_API_HOST } from "@/constants/public-envs";
import { getAuthToken } from "../../app/(app)/api/lib/getAuthToken";
import { getAuthToken } from "./auth-token";

const TeamAccountRole = {
MEMBER: "MEMBER",
Expand Down
6 changes: 3 additions & 3 deletions apps/dashboard/src/@/api/team-subscription.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getAuthToken } from "../../app/(app)/api/lib/getAuthToken";
import { NEXT_PUBLIC_THIRDWEB_API_HOST } from "../constants/public-envs";
import type { ProductSKU } from "../lib/billing";
import { getAuthToken } from "@/api/auth-token";
import { NEXT_PUBLIC_THIRDWEB_API_HOST } from "@/constants/public-envs";
import type { ProductSKU } from "@/types/billing";

type InvoiceLine = {
// amount for this line item
Expand Down
4 changes: 2 additions & 2 deletions apps/dashboard/src/@/api/team.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import "server-only";
import type { TeamResponse } from "@thirdweb-dev/service-utils";
import { cookies } from "next/headers";
import { LAST_USED_TEAM_ID } from "@/constants/cookies";
import { NEXT_PUBLIC_THIRDWEB_API_HOST } from "@/constants/public-envs";
import { API_SERVER_SECRET } from "@/constants/server-envs";
import { getValidAccount } from "../../app/(app)/account/settings/getAccount";
import { getAuthToken } from "../../app/(app)/api/lib/getAuthToken";
import { LAST_USED_TEAM_ID } from "../../constants/cookies";
import { getAuthToken } from "./auth-token";
import { getMemberByAccountId } from "./team-members";

export type Team = TeamResponse & { stripeCustomerId: string | null };
Expand Down
4 changes: 2 additions & 2 deletions apps/dashboard/src/@/api/universal-bridge/developer.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use server";
import { getAuthToken } from "app/(app)/api/lib/getAuthToken";
import { NEXT_PUBLIC_THIRDWEB_BRIDGE_HOST } from "../../constants/public-envs";
import { getAuthToken } from "@/api/auth-token";
import { NEXT_PUBLIC_THIRDWEB_BRIDGE_HOST } from "@/constants/public-envs";

const UB_BASE_URL = NEXT_PUBLIC_THIRDWEB_BRIDGE_HOST;

Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/src/@/api/universal-bridge/tokens.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use server";
import type { ProjectResponse } from "@thirdweb-dev/service-utils";
import { getAuthToken } from "app/(app)/api/lib/getAuthToken";
import { getAuthToken } from "@/api/auth-token";
import { DASHBOARD_THIRDWEB_SECRET_KEY } from "@/constants/server-envs";
import { UB_BASE_URL } from "./constants";

Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/src/@/api/usage/billing-preview.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import "server-only";

import { getAuthToken } from "@/api/auth-token";
import { NEXT_PUBLIC_THIRDWEB_API_HOST } from "@/constants/public-envs";
import { getAuthToken } from "../../../app/(app)/api/lib/getAuthToken";

type LineItem = {
quantity: number;
Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/src/@/api/usage/rpc.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import "server-only";
import { unstable_cache } from "next/cache";
import { ANALYTICS_SERVICE_URL } from "../../constants/server-envs";
import { ANALYTICS_SERVICE_URL } from "@/constants/server-envs";

type Last24HoursRPCUsageApiResponse = {
peakRate: {
Expand Down
Loading
Loading