[fix] negodata·frontend·backend: 회사별 브랜드 색(primary_color) 기능 전면 제거 — 편집 UI 없이 값만 남아 적용되던 구현 정리(포털·메일·사이드바 색 솔루션 고정, 시드·응답 필드 제거)

This commit is contained in:
minaChoi committed 2026-08-07 13:45:23 +09:00
1 parent 4ed23c56b8
commit 11b29b45e3
15 files changed
+19 -78

No files matched your search

-2
View File
@@ -57,7 +57,6 @@ export interface RefreshTokenResponse {
export interface Branding {
service_name?: string
logo_url?: string
primary_color?: string
helpdesk?: string[] // 헬프데스크 연락처 — 한 줄 = 담당자 한 명. 비면 연락처 영역을 렌더하지 않는다
}
@@ -66,7 +65,6 @@ export interface SessionBrandingResponse {
result: ApiResult
service_name: string
logo_url: string
primary_color: string
helpdesk?: string[]
}
@@ -43,10 +43,9 @@ export function usePreLoginBranding(): Branding | null {
const next: Branding = {
service_name: res.service_name || undefined,
logo_url: res.logo_url || undefined,
primary_color: res.primary_color || undefined,
helpdesk: res.helpdesk?.length ? res.helpdesk : undefined,
}
if (!next.service_name && !next.logo_url && !next.primary_color && !next.helpdesk) return
if (!next.service_name && !next.logo_url && !next.helpdesk) return
setBranding(next)
writeCached(next) // 다음 진입에 session_id 가 없어도 이 회사로 보이게 한다
})
+2 -3
View File
@@ -1,7 +1,7 @@
import { type ReactNode } from 'react'
import { Logo } from '@/components'
import { useMeQuery } from '@/apis'
import { cn, useBrandColor } from '@/lib'
import { cn } from '@/lib'
// 좌측 폭: list=반응형 비율 / chat=고정폭 단계 축소
const SIDEBAR_WIDTH = {
@@ -44,8 +44,7 @@ export function MainLayout({
header,
children,
}: MainLayoutProps) {
const { data: user } = useMeQuery() // 회사 브랜딩(서비스명/로고/브랜드 색) 주입
useBrandColor(user?.branding?.primary_color)
const { data: user } = useMeQuery() // 회사 브랜딩(서비스명/로고) 주입 — 색은 솔루션 고정
const panes = (
<>
<aside className={cn(styles.sidebar, SIDEBAR_WIDTH[sidebarWidth])}>
-1
View File
@@ -4,4 +4,3 @@ export type { ClassValue } from '@/lib/cn'
export { interactive } from '@/lib/interactive'
export { toast } from '@/lib/toast'
export { formatKstDateTime, KST_TIME_ZONE } from '@/lib/datetime'
export { useBrandColor } from '@/lib/useBrandColor'
-29
View File
@@ -1,29 +0,0 @@
import { useEffect } from 'react'
// 회사 브랜드 색(companies.settings.branding.primary_color)을 브랜드 CSS 변수에 적용한다.
// hover/ring/연한 배경은 color-mix 파생으로 만들어 토스풍 톤 관계를 유지하고,
// 색이 없거나 hex 가 아니면(injection 방지) 기본 팔레트(Toss blue)를 그대로 둔다.
const HEX_COLOR = /^#[0-9a-fA-F]{3,8}$/
const DERIVED = {
'--brand-600': (c: string) => c,
'--brand-700': (c: string) => `color-mix(in srgb, ${c} 85%, #000)`,
'--brand-500': (c: string) => `color-mix(in srgb, ${c} 70%, #fff)`,
'--brand-light': (c: string) => `color-mix(in srgb, ${c} 9%, #fff)`,
} as const
export function useBrandColor(color?: string) {
useEffect(() => {
const c = (color ?? '').trim()
if (!HEX_COLOR.test(c)) return
const root = document.documentElement.style
for (const [name, derive] of Object.entries(DERIVED)) {
root.setProperty(name, derive(c))
}
return () => {
for (const name of Object.keys(DERIVED)) {
root.removeProperty(name)
}
}
}, [color])
}
+1 -3
View File
@@ -2,12 +2,10 @@ import { Navigate } from 'react-router'
import { tokenStorage } from '@/apis'
import { Logo } from '@/components'
import { LoginForm, usePreLoginBranding } from '@/features/auth'
import { useBrandColor } from '@/lib'
export function LoginPage() {
// 초청 링크의 session_id(없으면 직전 로그인 캐시)로 회사 브랜딩을 먼저 그린다.
// 초청 링크의 session_id(없으면 직전 로그인 캐시)로 회사 브랜딩(서비스명·로고)을 먼저 그린다.
const branding = usePreLoginBranding()
useBrandColor(branding?.primary_color)
// 이미 로그인된 상태면 목록으로
if (tokenStorage.hasToken()) {