Skip to content

Commit

Permalink
refactor(WIP): dashboard stack to shacdn|tailwind|radix|tanstack
Browse files Browse the repository at this point in the history
  • Loading branch information
danh91 committed Sep 10, 2024
1 parent 5b235d9 commit 3a24ebc
Show file tree
Hide file tree
Showing 297 changed files with 7,918 additions and 3,270 deletions.
5 changes: 1 addition & 4 deletions apps/dashboard/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
"root": true,
"extends": [
"next",
"next/core-web-vitals"
]
"extends": ["next", "next/core-web-vitals"],
}
14 changes: 5 additions & 9 deletions apps/dashboard/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage
Expand All @@ -25,16 +26,11 @@ yarn-debug.log*
yarn-error.log*

# local env files
.env.local
.env.development.local
.env.test.local
.env.production.local
.env*.local

# vercel
.vercel
.env

# Sentry
.sentryclirc

karrio/rest/generated/.openapi-generator/
# typescript
*.tsbuildinfo
next-env.d.ts
36 changes: 36 additions & 0 deletions apps/dashboard/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).

## Getting Started

First, run the development server:

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.

This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.

## Learn More

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
2 changes: 1 addition & 1 deletion apps/dashboard/next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
45 changes: 0 additions & 45 deletions apps/dashboard/next.config.js

This file was deleted.

44 changes: 44 additions & 0 deletions apps/dashboard/next.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { withSentryConfig } from "@sentry/nextjs";
import path from "path";

const BASE_PATH = process.env.NEXT_PUBLIC_BASE_PATH || "";

/** @type {import('next').NextConfig} */
const nextConfig = {
basePath: BASE_PATH,
reactStrictMode: true,
transpilePackages: [
"@karrio/core",
"@karrio/hooks",
"@karrio/ui",
"@karrio/lib",
"@karrio/types",
"@karrio/insiders",
],
sentry: {
disableServerWebpackPlugin: true,
disableClientWebpackPlugin: true,
},
sassOptions: {
includePaths: [path.join("src", "app", "styles")],
},
webpack: (config) => {
config.resolve.fallback = { fs: false, net: false, tls: false };
config.externals.push("pino-pretty", "encoding");
return config;
},
};

const sentryWebpackPluginOptions = {
// Additional config options for the Sentry Webpack plugin. Keep in mind that
// the following options are set automatically, and overriding them is not
// recommended:
// release, url, org, project, authToken, configFile, stripPrefix,
// urlPrefix, include, ignore

silent: true, // Suppresses all logs
// For all available options, see:
// https://github.com/getsentry/sentry-webpack-plugin#options.
};

export default withSentryConfig(nextConfig, sentryWebpackPluginOptions);
20 changes: 10 additions & 10 deletions apps/dashboard/package.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
{
"name": "@karrio/dashboard",
"version": "1.0.0",
"name": "@karrio/platform",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
"gen:rest": "cd ..; ./bin/generate-rest-types",
"gen:graph": "cd ..; ./bin/generate-graphql-types",
"build:image": "cd ..; ./bin/build-dashboard-image"
"lint": "next lint"
},
"dependencies": {
"@karrio/core": "*",
"@karrio/hooks": "*",
"@karrio/lib": "*",
"@karrio/types": "*",
"@karrio/ui": "*"
"@karrio/ui": "*",
"@karrio/insiders": "*"
},
"devDependencies": {
"eslint": "7.32.0",
"eslint-config-custom": "*",
"eslint-config-next": "^13.1.2",
"postcss": "^8",
"tailwindcss": "^3.4.1",
"eslint": "^8",
"eslint-config-next": "14.2.8",
"tsconfig": "*"
}
}
8 changes: 8 additions & 0 deletions apps/dashboard/postcss.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/** @type {import('postcss-load-config').Config} */
const config = {
plugins: {
tailwindcss: {},
},
};

export default config;
8 changes: 4 additions & 4 deletions apps/dashboard/public/manifest.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"short_name": "purpleboard",
"name": "Purple Board",
"short_name": "karrio",
"name": "Karrio Board",
"icons": [
{
"src": "android-chrome-192x192.png",
"sizes": "192x192",
"type": "image\/png",
"type": "image/png",
"density": "4.0"
},
{
"src": "android-chrome-512x512.png",
"sizes": "512x512",
"type": "image\/png",
"type": "image/png",
"density": "4.0"
}
],
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { GET } from "@karrio/core/context/image";
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions apps/dashboard/src/app/(app)/test/admin/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from "@karrio/core/layouts/admin-layout";
File renamed without changes.
4 changes: 0 additions & 4 deletions apps/dashboard/src/app/(dashboard)/apps/development/page.tsx

This file was deleted.

1 change: 0 additions & 1 deletion apps/dashboard/src/app/(dashboard)/apps/page.tsx

This file was deleted.

1 change: 1 addition & 0 deletions apps/dashboard/src/app/(platform)/(auth)/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from "@karrio/insiders/layouts/dashboard-layout";
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export {
default,
generateMetadata,
} from "@karrio/insiders/modules/platform-carriers";
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export {
default,
generateMetadata,
} from "@karrio/insiders/modules/platform-orders";
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export {
default,
generateMetadata,
} from "@karrio/insiders/modules/platform-shipments";
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export {
default,
generateMetadata,
} from "@karrio/insiders/modules/platform-store";
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export {
default,
generateMetadata,
} from "@karrio/insiders/modules/platform-trackers";
2 changes: 2 additions & 0 deletions apps/dashboard/src/app/(platform)/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import "../../styles/globals.css";
export { default } from "@karrio/insiders/layouts/root-layout";

This file was deleted.

1 change: 0 additions & 1 deletion apps/dashboard/src/app/[domain]/(dashboard)/apps/page.tsx

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

44 changes: 1 addition & 43 deletions apps/dashboard/src/app/api/images/[name]/route.ts
Original file line number Diff line number Diff line change
@@ -1,43 +1 @@
import { formatCarrierSlug, getInitials, isNoneOrEmpty } from "@karrio/lib";
import { NextRequest } from "next/server";

export async function GET(
request: NextRequest,
{ params }: { params: { name: string } },
) {
const { name } = params;
const searchParams = request.nextUrl.searchParams;
const isIcon = name.includes("_icon");
const [_name, ..._] = name.replace(isIcon ? "_icon" : "_logo", "").split(".");
const carrier_name = isIcon
? getInitials(_name).substring(0, 2)
: formatCarrierSlug(_name);
const text_color = isNoneOrEmpty(searchParams.get("text_color"))
? "#ddd"
: decodeURIComponent(searchParams.get("text_color") as string);
const background = isNoneOrEmpty(searchParams.get("background"))
? "#7e51e1"
: decodeURIComponent(searchParams.get("background") as string);
const props = isIcon ? 'viewBox="0 0 512 512"' : 'viewBox="0 0 125 25"';
const path = isIcon
? `<path xmlns="http://www.w3.org/2000/svg" style="fill-rule:evenodd;clip-rule:evenodd;fill:${background};" d="M512,472c0,22.1-17.9,40-40,40H40c-22.1,0-40-17.9-40-40V40C0,17.9,17.9,0,40,0h432c22.1,0,40,17.9,40,40V472z"/>`
: `<path xmlns="http://www.w3.org/2000/svg" style="fill-rule:evenodd;clip-rule:evenodd;fill:${background};" d="M125,0v25H0V0H125z"/>`;

const content = `<svg ${props} x="0px" y="0px" xmlns="http://www.w3.org/2000/svg">
<g>
${path}
<text x="50%" y="55%" alignment-baseline="middle" text-anchor="middle" fill="${text_color}" font-weight="bold" font-family="arial"
font-size="${isIcon ? "16em" : ".95em"}" style="text-transform: uppercase; ${isIcon ? "border-radius: 40px;" : "4px"}">
${carrier_name}
</text>
</g>
</svg>
`;

return new Response(content, {
headers: {
"Content-Type": "image/svg+xml",
},
});
}
export { GET } from "@karrio/core/context/image";

This file was deleted.

1 change: 0 additions & 1 deletion apps/dashboard/src/app/test/(dashboard)/apps/page.tsx

This file was deleted.

This file was deleted.

4 changes: 0 additions & 4 deletions apps/dashboard/src/app/test/(dashboard)/email/change/page.tsx

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 3a24ebc

Please sign in to comment.