Skip to content

Commit

Permalink
perf!: Remove dynamic icons from nav
Browse files Browse the repository at this point in the history
  • Loading branch information
aXenDeveloper committed Sep 18, 2024
1 parent 2d70d66 commit e7243ac
Show file tree
Hide file tree
Showing 38 changed files with 1,291 additions and 1,414 deletions.
12 changes: 6 additions & 6 deletions apps/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
},
"dependencies": {
"@nestjs/apollo": "^12.2.0",
"@nestjs/common": "^10.4.1",
"@nestjs/common": "^10.4.3",
"@nestjs/config": "^3.2.3",
"@nestjs/core": "^10.4.1",
"@nestjs/core": "^10.4.3",
"@nestjs/graphql": "^12.2.0",
"@nestjs/jwt": "^10.2.0",
"@nestjs/platform-express": "^10.4.1",
"@nestjs/schedule": "^4.1.0",
"@nestjs/platform-express": "^10.4.3",
"@nestjs/schedule": "^4.1.1",
"@nestjs/serve-static": "^4.0.2",
"pg": "^8.12.0",
"pg": "^8.13.0",
"react": "19.0.0-rc-fb9a90fa48-20240614",
"react-dom": "19.0.0-rc-fb9a90fa48-20240614",
"reflect-metadata": "^0.2.2",
Expand All @@ -42,7 +42,7 @@
"@types/express": "^4.17.21",
"@types/node": "^22.5.5",
"@types/pg": "^8.11.10",
"@types/react": "^18.3.5",
"@types/react": "^18.3.7",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.1",
"cross-env": "^7.0.3",
Expand Down
6 changes: 2 additions & 4 deletions apps/backend/schema.gql
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,9 @@ type Mutation {
admin__core_staff_moderators__create(group_id: Int, unrestricted: Boolean!, user_id: Int): ShowAdminStaffModerators!
admin__core_staff_moderators__delete(id: Int!): String!
admin__core_styles__editor__edit(files: FilesEditAdminEditorStyles!, sticky: Boolean!): EditorShowCoreMiddleware!
admin__core_styles__nav__create(description: [StringLanguageInput!]!, external: Boolean!, href: String!, icon: String, name: [StringLanguageInput!]!): ShowCoreNav!
admin__core_styles__nav__create(description: [StringLanguageInput!]!, external: Boolean!, href: String!, name: [StringLanguageInput!]!): ShowCoreNav!
admin__core_styles__nav__delete(id: Int!): String!
admin__core_styles__nav__edit(description: [StringLanguageInput!]!, external: Boolean!, href: String!, icon: String, id: Int!, name: [StringLanguageInput!]!): ShowCoreNav!
admin__core_styles__nav__edit(description: [StringLanguageInput!]!, external: Boolean!, href: String!, id: Int!, name: [StringLanguageInput!]!): ShowCoreNav!
admin__core_terms_settings__create(code: String!, content: [StringLanguageInput!]!, href: String, title: [StringLanguageInput!]!): ShowCoreTerms!
admin__core_terms_settings__delete(code: String!): String!
admin__core_terms_settings__edit(code: String!, content: [StringLanguageInput!]!, href: String, id: Float!, title: [StringLanguageInput!]!): ShowCoreTerms!
Expand Down Expand Up @@ -638,7 +638,6 @@ type ShowCoreNav {
description: [StringLanguage!]!
external: Boolean!
href: String!
icon: String
id: Int!
name: [StringLanguage!]!
position: Int!
Expand All @@ -648,7 +647,6 @@ type ShowCoreNavItem {
description: [StringLanguage!]!
external: Boolean!
href: String!
icon: String
id: Int!
name: [StringLanguage!]!
position: Int!
Expand Down
10 changes: 5 additions & 5 deletions apps/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"dependencies": {
"geist": "^1.3.1",
"lucide-react": "^0.441.0",
"next": "15.0.0-canary.155",
"next-intl": "^3.19.1",
"next": "15.0.0-canary.158",
"next-intl": "^3.19.3",
"react": "19.0.0-rc-fb9a90fa48-20240614",
"react-dom": "19.0.0-rc-fb9a90fa48-20240614",
"react-hook-form": "^7.53.0",
Expand All @@ -29,13 +29,13 @@
},
"devDependencies": {
"@types/node": "^22.5.5",
"@types/react": "^18.3.5",
"@types/react": "^18.3.7",
"@types/react-dom": "^18.3.0",
"autoprefixer": "^10.4.20",
"eslint-config-typescript-vitnode": "workspace:*",
"graphql-tag": "^2.12.6",
"postcss": "^8.4.45",
"tailwindcss": "^3.4.11",
"postcss": "^8.4.47",
"tailwindcss": "^3.4.12",
"typescript": "^5.6.2"
}
}
2 changes: 1 addition & 1 deletion apps/frontend/src/app/[locale]/(main)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default function Page(props: DefaultPageProps) {
return (
<DefaultPage
pathToDefaultPage={async plugin =>
import(`../../../plugins/${plugin}/templates/default-page`)
import(`@/plugins/${plugin}/templates/default-page`)
}
{...props}
/>
Expand Down
4 changes: 0 additions & 4 deletions apps/frontend/src/graphql/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,6 @@ export type MutationAdmin__Core_Styles__Nav__CreateArgs = {
description: Array<StringLanguageInput>;
external: Scalars['Boolean']['input'];
href: Scalars['String']['input'];
icon?: InputMaybe<Scalars['String']['input']>;
name: Array<StringLanguageInput>;
};

Expand All @@ -542,7 +541,6 @@ export type MutationAdmin__Core_Styles__Nav__EditArgs = {
description: Array<StringLanguageInput>;
external: Scalars['Boolean']['input'];
href: Scalars['String']['input'];
icon?: InputMaybe<Scalars['String']['input']>;
id: Scalars['Int']['input'];
name: Array<StringLanguageInput>;
};
Expand Down Expand Up @@ -1146,7 +1144,6 @@ export type ShowCoreNav = {
description: Array<StringLanguage>;
external: Scalars['Boolean']['output'];
href: Scalars['String']['output'];
icon?: Maybe<Scalars['String']['output']>;
id: Scalars['Int']['output'];
name: Array<StringLanguage>;
position: Scalars['Int']['output'];
Expand All @@ -1157,7 +1154,6 @@ export type ShowCoreNavItem = {
description: Array<StringLanguage>;
external: Scalars['Boolean']['output'];
href: Scalars['String']['output'];
icon?: Maybe<Scalars['String']['output']>;
id: Scalars['Int']['output'];
name: Array<StringLanguage>;
position: Scalars['Int']['output'];
Expand Down
14 changes: 7 additions & 7 deletions packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,21 +81,21 @@
},
"devDependencies": {
"@graphql-codegen/cli": "^5.0.2",
"@nestjs/common": "^10.4.1",
"@nestjs/core": "^10.4.1",
"@nestjs/common": "^10.4.3",
"@nestjs/core": "^10.4.3",
"@nestjs/graphql": "^12.2.0",
"@nestjs/schedule": "^4.1.0",
"@nestjs/schedule": "^4.1.1",
"@nestjs/throttler": "^6.2.1",
"@react-email/components": "^0.0.25",
"@types/busboy": "^1.5.4",
"@types/cookie-parser": "^1.4.7",
"@types/express": "^4.17.21",
"@types/http-errors": "^2.0.4",
"@types/node": "^22.5.5",
"@types/nodemailer": "^6.4.15",
"@types/nodemailer": "^6.4.16",
"@types/object-path": "^0.11.4",
"@types/pg": "^8.11.10",
"@types/react": "^18.3.5",
"@types/react": "^18.3.7",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.1",
"concurrently": "^9.0.1",
Expand All @@ -105,11 +105,11 @@
"eslint-config-typescript-vitnode": "workspace:*",
"express": "^4.21.0",
"graphql": "^16.9.0",
"pg": "^8.12.0",
"pg": "^8.13.0",
"react": "19.0.0-rc-e56f4ae3-20240830",
"react-dom": "19.0.0-rc-e56f4ae3-20240830",
"ts-node": "^10.9.2",
"tsup": "^8.2.4",
"tsup": "^8.3.0",
"typescript": "^5.6.2"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ export class CreateAdminNavStylesArgs {
@MaxLength(255)
href: string;

@Field(() => String, { nullable: true })
icon: null | string;

@ArrayMinSize(1)
@Transform(TransformStringLanguageInput)
@Field(() => [StringLanguageInput])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export class CreateAdminNavStylesService {
description,
external,
href,
icon,
name,
}: CreateAdminNavStylesArgs): Promise<ShowCoreNav> {
const theMostHighestPosition =
Expand All @@ -31,7 +30,6 @@ export class CreateAdminNavStylesService {
.values({
href,
external,
icon,
position: theMostHighestPosition
? theMostHighestPosition.position + 1
: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export class EditAdminNavStylesService {
description,
external,
href,
icon,
id,
name,
}: EditAdminNavStylesArgs): Promise<ShowCoreNav> {
Expand All @@ -36,7 +35,6 @@ export class EditAdminNavStylesService {
.set({
href,
external,
icon,
})
.where(eq(core_nav.id, id))
.returning();
Expand Down
3 changes: 0 additions & 3 deletions packages/backend/src/core/nav/show/show.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ class ShowCoreNavItem {
@Field(() => String)
href: string;

@Field(() => String, { nullable: true })
icon: null | string;

@Field(() => Int)
id: number;

Expand Down
1 change: 0 additions & 1 deletion packages/backend/src/database/schema/nav.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export const core_nav = pgTable(
position: integer('position').notNull().default(0),
// ! Warning: this is a recursive relation. It's not supported by drizzle-orm yet.
parent_id: integer('parent_id').notNull().default(0),
icon: varchar('icon', { length: 50 }),
},
table => ({
parent_id_idx: index('core_nav_parent_id_idx').on(table.parent_id),
Expand Down
18 changes: 9 additions & 9 deletions packages/create-vitnode-app/helpers/create-packages-json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,14 @@ export const createPackagesJSON = ({
},
devDependencies: {
'@types/node': '^22.5.5',
'@types/react': '^18.3.5',
'@types/react': '^18.3.7',
'@types/react-dom': '^18.3.0',
autoprefixer: '^10.4.20',
...(eslint ? { eslint: '^9.10.0' } : {}),
'eslint-config-typescript-vitnode': `^${pkg.version}`,
'graphql-tag': '^2.12.6',
postcss: '^8.4.45',
tailwindcss: '^3.4.11',
postcss: '^8.4.47',
tailwindcss: '^3.4.12',
typescript: '^5.6.2',
},
};
Expand All @@ -133,10 +133,10 @@ export const createPackagesJSON = ({
db: 'vitnode-backend db',
},
dependencies: {
'@nestjs/common': '^10.4.1',
'@nestjs/core': '^10.4.1',
'@nestjs/common': '^10.4.3',
'@nestjs/core': '^10.4.3',
'@nestjs/graphql': '^12.2.0',
'@nestjs/schedule': '^4.1.0',
'@nestjs/schedule': '^4.1.1',
'@nestjs/throttler': '^6.2.1',
'@react-email/components': '^0.0.25',
'class-transformer': '^0.5.1',
Expand All @@ -149,18 +149,18 @@ export const createPackagesJSON = ({
devDependencies: {
'@graphql-codegen/cli': '^5.0.2',
'@nestjs/cli': '^10.4.5',
'@nestjs/platform-express': '^10.4.1',
'@nestjs/platform-express': '^10.4.3',
'@nestjs/schematics': '^10.1.4',
'@types/express': '^4.17.21',
'@types/node': '^22.5.5',
'@types/pg': '^8.11.10',
'@types/react': '^18.3.5',
'@types/react': '^18.3.7',
'cross-env': '^7.0.3',
'drizzle-kit': '^0.24.2',
'drizzle-orm': '^0.33.0',
...(eslint ? { eslint: '^9.10.0' } : {}),
'eslint-config-typescript-vitnode': `^${pkg.version}`,
pg: '^8.12.0',
pg: '^8.13.0',
'source-map-support': '^0.5.21',
'ts-loader': '^9.5.1',
'ts-node': '^10.9.2',
Expand Down
2 changes: 1 addition & 1 deletion packages/create-vitnode-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"cross-spawn": "^7.0.3",
"eslint-config-typescript-vitnode": "workspace:*",
"ora": "^8.1.0",
"tsup": "^8.2.4",
"tsup": "^8.3.0",
"typescript": "^5.6.2"
}
}
2 changes: 1 addition & 1 deletion packages/eslint-config-typescript-vitnode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@
"eslint-plugin-react": "^7.36.1",
"globals": "^15.9.0",
"prettier-plugin-tailwindcss": "^0.6.6",
"typescript-eslint": "^8.5.0"
"typescript-eslint": "^8.6.0"
}
}
36 changes: 18 additions & 18 deletions packages/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,21 +112,21 @@
"@types/lodash": "^4.17.7",
"@types/node": "^22.5.5",
"@types/nprogress": "^0.2.3",
"@types/react": "^18.3.5",
"@types/react": "^18.3.7",
"@types/react-dom": "^18.3.0",
"concurrently": "^9.0.1",
"dotenv": "^16.4.5",
"eslint-config-typescript-vitnode": "workspace:*",
"graphql-tag": "^2.12.6",
"lucide-react": "^0.441.0",
"next": "15.0.0-canary.155",
"next-intl": "^3.19.1",
"next": "15.0.0-canary.158",
"next-intl": "^3.19.3",
"react": "19.0.0-rc-e56f4ae3-20240830",
"react-dom": "19.0.0-rc-e56f4ae3-20240830",
"react-hook-form": "^7.53.0",
"sonner": "^1.5.0",
"tailwindcss": "^3.4.11",
"tsup": "^8.2.4",
"tailwindcss": "^3.4.12",
"tsup": "^8.3.0",
"typescript": "^5.6.2",
"zod": "^3.23.8"
},
Expand Down Expand Up @@ -156,18 +156,18 @@
"@radix-ui/react-tooltip": "^1.1.2",
"@tailwindcss/container-queries": "^0.1.1",
"@tanstack/react-query": "^5.56.2",
"@tiptap/extension-code-block-lowlight": "^2.6.6",
"@tiptap/extension-color": "^2.6.6",
"@tiptap/extension-heading": "^2.6.6",
"@tiptap/extension-link": "^2.6.6",
"@tiptap/extension-mention": "^2.6.6",
"@tiptap/extension-text-align": "^2.6.6",
"@tiptap/extension-text-style": "^2.6.6",
"@tiptap/extension-underline": "^2.6.6",
"@tiptap/html": "^2.6.6",
"@tiptap/pm": "^2.6.6",
"@tiptap/react": "^2.6.6",
"@tiptap/starter-kit": "^2.6.6",
"@tiptap/extension-code-block-lowlight": "^2.7.1",
"@tiptap/extension-color": "^2.7.1",
"@tiptap/extension-heading": "^2.7.1",
"@tiptap/extension-link": "^2.7.1",
"@tiptap/extension-mention": "^2.7.1",
"@tiptap/extension-text-align": "^2.7.1",
"@tiptap/extension-text-style": "^2.7.1",
"@tiptap/extension-underline": "^2.7.1",
"@tiptap/html": "^2.7.1",
"@tiptap/pm": "^2.7.1",
"@tiptap/react": "^2.7.1",
"@tiptap/starter-kit": "^2.7.1",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"cmdk": "^1.0.0",
Expand All @@ -189,6 +189,6 @@
"tailwindcss-animate": "^1.0.7",
"tippy.js": "^6.3.7",
"use-debounce": "^10.0.3",
"vaul": "^0.9.3"
"vaul": "^0.9.4"
}
}
1 change: 0 additions & 1 deletion packages/frontend/src/components/icon/icon-client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export const IconClient = React.memo(
return <span className={className}>{name}</span>;
}

// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
const LucideIcon = dynamic(dynamicIconImports[name]);

Check failure on line 16 in packages/frontend/src/components/icon/icon-client.tsx

View workflow job for this annotation

GitHub Actions / linting

Unsafe argument of type error typed assigned to a parameter of type `DynamicOptions<{}> | Loader<{}>`

return (
Expand Down
1 change: 0 additions & 1 deletion packages/frontend/src/components/icon/icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export const Icon = ({ className, name, ...props }: Props) => {
);
}

// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
const LucideIcon = dynamic(dynamicIconImports[name]);

Check failure on line 20 in packages/frontend/src/components/icon/icon.tsx

View workflow job for this annotation

GitHub Actions / linting

Unsafe argument of type error typed assigned to a parameter of type `DynamicOptions<{}> | Loader<{}>`

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
Expand Down
Loading

0 comments on commit e7243ac

Please sign in to comment.