Skip to content

Commit

Permalink
feat: replace local theme with LOCAL_FORM_THEME in SetupYourAgent and…
Browse files Browse the repository at this point in the history
… UpdateAgentPage components
  • Loading branch information
mohandast52 committed Dec 27, 2024
1 parent 7b8b2cb commit f7a880d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,14 @@ import { SetupScreen } from '@/enums/SetupScreen';
import { useServices } from '@/hooks/useServices';
import { useSetup } from '@/hooks/useSetup';
import { useStakingProgram } from '@/hooks/useStakingProgram';
import { LOCAL_FORM_THEME } from '@/theme';

import { SetupCreateHeader } from '../Create/SetupCreateHeader';
import { useMemeFormValidate } from '../hooks/useMemeFormValidate';
import { onDummyServiceCreation } from './validation';

const { Title, Text } = Typography;

// TODO: consolidate theme into mainTheme
const LOCAL_THEME = { components: { Input: { fontSize: 16 } } };

type FieldValues = {
personaDescription: string;
geminiApiKey: string;
Expand Down Expand Up @@ -314,7 +312,7 @@ export const SetupYourAgent = () => {
}

return (
<ConfigProvider theme={LOCAL_THEME}>
<ConfigProvider theme={LOCAL_FORM_THEME}>
<CardFlex gap={10} styles={{ body: { padding: '12px 24px' } }}>
<SetupCreateHeader prev={SetupScreen.AgentSelection} />
<Title level={3}>Set up your agent</Title>
Expand Down
34 changes: 16 additions & 18 deletions frontend/components/UpdateAgentPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { AgentType } from '@/enums/Agent';
import { Pages } from '@/enums/Pages';
import { usePageState } from '@/hooks/usePageState';
import { useServices } from '@/hooks/useServices';
import { LOCAL_FORM_THEME } from '@/theme';

import { CardTitle } from '../Card/CardTitle';
import { CardFlex } from '../styled/CardFlex';
Expand All @@ -15,9 +16,6 @@ import {
} from './context/UpdateAgentProvider';
import { MemeUpdateForm } from './MemeUpdateForm';

// TODO: consolidate theme into mainTheme
const LOCAL_THEME = { components: { Input: { fontSize: 16 } } };

const EditButton = () => {
const { setIsEditing } = useContext(UpdateAgentContext);

Expand Down Expand Up @@ -48,27 +46,27 @@ const UpdateAgentPageCard = () => {
}, [hasUnsavedChanges, unsavedModal, goto]);

return (
<ConfigProvider theme={LOCAL_THEME}>
<CardFlex
bordered={false}
title={
<CardTitle
backButtonCallback={handleClickBack}
title={isEditing ? 'Edit agent settings' : 'Agent settings'}
/>
}
extra={isEditing ? null : <EditButton />}
>
{selectedAgentType === AgentType.Memeooorr && <MemeUpdateForm />}
</CardFlex>
</ConfigProvider>
<CardFlex
bordered={false}
title={
<CardTitle
backButtonCallback={handleClickBack}
title={isEditing ? 'Edit agent settings' : 'Agent settings'}
/>
}
extra={isEditing ? null : <EditButton />}
>
{selectedAgentType === AgentType.Memeooorr && <MemeUpdateForm />}
</CardFlex>
);
};

export const UpdateAgentPage = () => {
return (
<UpdateAgentProvider>
<UpdateAgentPageCard />
<ConfigProvider theme={LOCAL_FORM_THEME}>
<UpdateAgentPageCard />
</ConfigProvider>
</UpdateAgentProvider>
);
};
3 changes: 3 additions & 0 deletions frontend/theme/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,6 @@ export const mainTheme: ThemeConfig = {
},
},
};

// TODO: consolidate theme into mainTheme
export const LOCAL_FORM_THEME = { components: { Input: { fontSize: 16 } } };

0 comments on commit f7a880d

Please sign in to comment.