Skip to content

Commit bee02b5

Browse files
committed
メモ化と不要コードの削除
1 parent bfabaed commit bee02b5

File tree

2 files changed

+15
-20
lines changed

2 files changed

+15
-20
lines changed

packages/web/src/hooks/useBranding.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ const useBranding = (): BrandingConfig => {
1010
const logoPath = import.meta.env.VITE_APP_BRANDING_LOGO_PATH;
1111
const title = import.meta.env.VITE_APP_BRANDING_TITLE;
1212

13-
console.log('Branding config:', { logoPath, title });
14-
1513
return {
1614
logoPath: logoPath || '',
1715
title: title || '',

packages/web/src/pages/LandingPage.tsx

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useState, useEffect } from 'react';
1+
import React, { useMemo } from 'react';
22
import { useNavigate } from 'react-router-dom';
33
import CardDemo from '../components/CardDemo';
44
import Button from '../components/Button';
@@ -23,7 +23,7 @@ import {
2323
} from 'react-icons/pi';
2424
import AwsIcon from '../assets/aws.svg?react';
2525
import useInterUseCases from '../hooks/useInterUseCases';
26-
import useBranding from '../hooks/useBranding';
26+
2727
import {
2828
AgentPageQueryParams,
2929
ChatPageQueryParams,
@@ -52,6 +52,8 @@ const agentCoreEnabled: boolean =
5252
import.meta.env.VITE_APP_AGENT_CORE_ENABLED === 'true';
5353
const inlineAgents: boolean = import.meta.env.VITE_APP_INLINE_AGENTS === 'true';
5454
const mcpEnabled: boolean = import.meta.env.VITE_APP_MCP_ENABLED === 'true';
55+
const logoPath: string = import.meta.env.VITE_APP_BRANDING_LOGO_PATH || '';
56+
const brandingTitle: string = import.meta.env.VITE_APP_BRANDING_TITLE || '';
5557
const {
5658
imageGenModelIds,
5759
videoGenModelIds,
@@ -66,27 +68,22 @@ const LandingPage: React.FC = () => {
6668
const { enabled } = useUseCases();
6769
const { setIsShow, init } = useInterUseCases();
6870
const { t } = useTranslation();
69-
const { logoPath, title } = useBranding();
70-
const [customLogoUrl, setCustomLogoUrl] = useState<string>('');
7171

72-
// Load custom logo dynamically
73-
useEffect(() => {
72+
const displayLogo = useMemo(() => {
7473
if (logoPath) {
75-
console.log('Loading custom logo:', logoPath);
7674
const logoUrl = new URL(`../assets/${logoPath}`, import.meta.url).href;
77-
setCustomLogoUrl(logoUrl);
78-
} else {
79-
setCustomLogoUrl('');
75+
return (
76+
<img
77+
src={logoUrl}
78+
alt={brandingTitle || 'Logo'}
79+
className="mr-5 size-20"
80+
/>
81+
);
8082
}
81-
}, [logoPath]);
83+
return <AwsIcon className="mr-5 size-20" />;
84+
}, []);
8285

83-
// Determine which logo and title to use
84-
const displayLogo = customLogoUrl ? (
85-
<img src={customLogoUrl} alt={title || 'Logo'} className="mr-5 size-20" />
86-
) : (
87-
<AwsIcon className="mr-5 size-20" />
88-
);
89-
const displayTitle = title || t('landing.title');
86+
const displayTitle = brandingTitle || t('landing.title');
9087

9188
const demoChat = () => {
9289
const params: ChatPageQueryParams = {

0 commit comments

Comments
 (0)