11import { Badge , Box , Center , Divider , Group , Image , Stack , Text , Title } from '@mantine/core'
22import { GetStatusCommand } from '@remnawave/backend-contract'
3- import { useLayoutEffect } from 'react'
3+ import { useLayoutEffect , useMemo } from 'react'
44
55import { TelegramLoginButtonFeature } from '@features/auth/telegram-login-button/telegram-login-button.feature'
66import { OAuth2LoginButtonsFeature } from '@features/auth/oauth2-login-button/oauth2-login-button.feature'
@@ -9,6 +9,7 @@ import { useGetAuthStatus } from '@shared/api/hooks/auth/auth.query.hooks'
99import { RegisterFormFeature } from '@features/auth/register-form'
1010import { LoginFormFeature } from '@features/auth/login-form'
1111import { clearQueryClient } from '@shared/api/query-client'
12+ import { parseColoredTextUtil } from '@shared/utils/misc'
1213import { LoadingScreen } from '@shared/ui'
1314import { Logo } from '@shared/ui/logo'
1415import { Page } from '@shared/ui/page'
@@ -50,25 +51,22 @@ const BrandLogo = ({ logoUrl }: { logoUrl?: null | string }) => {
5051 )
5152}
5253
53- const BrandTitle = ( { title } : { title ?: null | string } ) => {
54- if ( ! title ) {
55- return (
56- < Title ff = "Unbounded" order = { 1 } pos = "relative" >
57- < Text c = "cyan" component = "span" fw = "inherit" fz = "inherit" pos = "relative" >
58- Remna
59- </ Text >
60- < Text c = "white" component = "span" fw = "inherit" fz = "inherit" pos = "relative" >
61- wave
62- </ Text >
63- </ Title >
64- )
65- }
66-
54+ const BrandTitle = ( { titleParts } : { titleParts : Array < { color : string ; text : string } > } ) => {
6755 return (
6856 < Title ff = "Unbounded" order = { 1 } pos = "relative" >
69- < Text c = "white" component = "span" fw = "inherit" fz = "inherit" pos = "relative" >
70- { title }
71- </ Text >
57+ { titleParts . map ( ( part , index ) => (
58+ < Text
59+ c = { part . color || 'white' }
60+ component = "span"
61+ fw = "inherit"
62+ fz = "inherit"
63+ inherit
64+ key = { index }
65+ pos = "relative"
66+ >
67+ { part . text }
68+ </ Text >
69+ ) ) }
7270 </ Title >
7371 )
7472}
@@ -108,6 +106,17 @@ export const LoginPage = () => {
108106 clearQueryClient ( )
109107 } , [ ] )
110108
109+ const titleParts = useMemo ( ( ) => {
110+ if ( authStatus ?. branding . title ) {
111+ return parseColoredTextUtil ( authStatus . branding . title )
112+ }
113+
114+ return [
115+ { text : 'Remna' , color : 'cyan' } ,
116+ { text : 'wave' , color : 'white' }
117+ ]
118+ } , [ authStatus ?. branding . title ] )
119+
111120 if ( isFetching ) {
112121 return < LoadingScreen height = "60vh" />
113122 }
@@ -120,7 +129,7 @@ export const LoginPage = () => {
120129 < Stack align = "center" gap = "xs" >
121130 < Group align = "center" gap = { 4 } justify = "center" >
122131 < BrandLogo logoUrl = { authStatus ?. branding . logoUrl } />
123- < BrandTitle title = { authStatus ?. branding . title } />
132+ < BrandTitle titleParts = { titleParts } />
124133 </ Group >
125134
126135 { ! authStatus && (
0 commit comments