From 6089542860d647685727caa41056c6fdc6e6576d Mon Sep 17 00:00:00 2001 From: Anton Date: Thu, 29 Feb 2024 00:47:11 +0300 Subject: [PATCH] feat: config logo --- package-lock.json | 8 ++++---- package.json | 2 +- .../20240228135246_config_logo/migration.sql | 2 ++ prisma/schema.prisma | 5 +++-- src/components/Page/Page.tsx | 4 ++-- src/components/PageHeader/PageHeader.tsx | 6 +++--- src/components/PageHeaderLogo.tsx | 16 ++++++---------- 7 files changed, 21 insertions(+), 22 deletions(-) create mode 100644 prisma/migrations/20240228135246_config_logo/migration.sql diff --git a/package-lock.json b/package-lock.json index 08186c43e..274a05a6e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,7 +25,7 @@ "@sentry/nextjs": "7.92.0", "@tanstack/react-query": "4.29.5", "@tanstack/react-query-devtools": "4.29.6", - "@taskany/bricks": "5.16.2", + "@taskany/bricks": "5.17.0", "@taskany/colors": "1.11.0", "@taskany/icons": "2.0.1", "@tippyjs/react": "4.2.6", @@ -7848,9 +7848,9 @@ } }, "node_modules/@taskany/bricks": { - "version": "5.16.2", - "resolved": "https://registry.npmjs.org/@taskany/bricks/-/bricks-5.16.2.tgz", - "integrity": "sha512-2yRwUjJ+q+0L0+XjCrkQaE/T4jGDABFbdf3xqhbX+ouzCw+L7XFBlG3Y8P7g+3vJyitpzav8T3Azoylg8l3alQ==", + "version": "5.17.0", + "resolved": "https://registry.npmjs.org/@taskany/bricks/-/bricks-5.17.0.tgz", + "integrity": "sha512-pww99ulRWxtbOoGvSrnObKLB/vUGNjspJe6W/Dw4gNVkn/2vKRecZ8dNtPBCXSagVObC/19rwPMhs+c+n1OLig==", "dependencies": { "@monaco-editor/react": "4.6.0", "@taskany/colors": "1.11.0", diff --git a/package.json b/package.json index e77c5d4ad..c322ac0b9 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "@sentry/nextjs": "7.92.0", "@tanstack/react-query": "4.29.5", "@tanstack/react-query-devtools": "4.29.6", - "@taskany/bricks": "5.16.2", + "@taskany/bricks": "5.17.0", "@taskany/colors": "1.11.0", "@taskany/icons": "2.0.1", "@tippyjs/react": "4.2.6", diff --git a/prisma/migrations/20240228135246_config_logo/migration.sql b/prisma/migrations/20240228135246_config_logo/migration.sql new file mode 100644 index 000000000..c80551eea --- /dev/null +++ b/prisma/migrations/20240228135246_config_logo/migration.sql @@ -0,0 +1,2 @@ +-- AlterTable +ALTER TABLE "AppConfig" ADD COLUMN "favicon" TEXT; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 4d3cbe160..0ff6892b6 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -406,6 +406,7 @@ model Team { } model AppConfig { - id String @id @default(cuid()) - logo String? + id String @id @default(cuid()) + favicon String? + logo String? } diff --git a/src/components/Page/Page.tsx b/src/components/Page/Page.tsx index 99e6b4413..5286f5b19 100644 --- a/src/components/Page/Page.tsx +++ b/src/components/Page/Page.tsx @@ -63,7 +63,7 @@ export const Page: React.FC = ({ user, ssrTime, title = 'Untitled', c return ( - + {title} @@ -83,7 +83,7 @@ export const Page: React.FC = ({ user, ssrTime, title = 'Untitled', c position="bottom-right" /> - +
{children} diff --git a/src/components/PageHeader/PageHeader.tsx b/src/components/PageHeader/PageHeader.tsx index bcfb78389..ef28fbd96 100644 --- a/src/components/PageHeader/PageHeader.tsx +++ b/src/components/PageHeader/PageHeader.tsx @@ -1,4 +1,4 @@ -import { FC, useCallback } from 'react'; +import { ComponentProps, FC, useCallback } from 'react'; import NextLink from 'next/link'; import { Header, @@ -22,7 +22,7 @@ import { BetaBadge } from '../BetaBadge'; import { tr } from './PageHeader.i18n'; import s from './PageHeader.module.css'; -export const PageHeader: FC = () => { +export const PageHeader: FC<{ logo?: ComponentProps['logo'] }> = ({ logo }) => { const { userSettings, signIn } = useRouter(); const { user } = usePageContext(); @@ -52,7 +52,7 @@ export const PageHeader: FC = () => { className={s.PageHeader} logo={ - + } menu={ diff --git a/src/components/PageHeaderLogo.tsx b/src/components/PageHeaderLogo.tsx index 65b042b29..66feaa48a 100644 --- a/src/components/PageHeaderLogo.tsx +++ b/src/components/PageHeaderLogo.tsx @@ -1,14 +1,10 @@ import NextLink from 'next/link'; -import { TaskanyLogo } from '@taskany/bricks'; +import { TaskanyLogo } from '@taskany/bricks/harmony'; import { routes } from '../hooks/router'; -export const PageHeaderLogo: React.FC = () => { - // TODO: resolve custom logo from settings in db - - return ( - - - - ); -}; +export const PageHeaderLogo: React.FC<{ logo?: string }> = ({ logo }) => ( + + + +);