Skip to content

Commit

Permalink
feat: added isAvatar3D flag for making the Avatar Controls visible
Browse files Browse the repository at this point in the history
  • Loading branch information
andrepat0 committed Nov 7, 2024
1 parent 2b0c360 commit d36b0de
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 50 deletions.
1 change: 1 addition & 0 deletions src/components/MemoriWidget/MemoriWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3389,6 +3389,7 @@ const MemoriWidget = ({
setAvatarType={setAvatarType}
enablePositionControls={enablePositionControls}
setEnablePositionControls={setEnablePositionControls}
isAvatar3d={!!integrationConfig?.avatarURL}
additionalSettings={additionalSettings}
/>
)}
Expand Down
114 changes: 64 additions & 50 deletions src/components/SettingsDrawer/SettingsDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export interface Props {
setAvatarType: (value: 'blob' | 'avatar3d') => void;
enablePositionControls?: boolean;
setEnablePositionControls: (value: boolean) => void;
isAvatar3d?: boolean;
}

const silenceSeconds = [2, 3, 5, 10, 15, 20, 30, 60];
Expand All @@ -46,6 +47,7 @@ const SettingsDrawer = ({
setAvatarType,
enablePositionControls,
setEnablePositionControls,
isAvatar3d,
}: Props) => {
const { t } = useTranslation();

Expand Down Expand Up @@ -153,58 +155,70 @@ const SettingsDrawer = ({
</RadioGroup.Option>
</RadioGroup>
</div>
<div className="memori-settings-drawer--field controls">
<label htmlFor="#avatarControls" style={{ marginBottom: '1rem' }}>
{t('write_and_speak.avatarControls') || 'Avatar controls'}:
</label>

<label htmlFor="avatarType" className="memori-settings-drawer-label">
{t('write_and_speak.avatarType') || 'Avatar type'}:
</label>
<RadioGroup
id="avatarType"
name="avatarType"
value={avatarType}
defaultValue={avatarType}
className="memori-settings-drawer--avatarType-radio"
onChange={(value: any) => {
setAvatarType && setAvatarType(value);
setLocalConfig('avatarType', value);
}}
>
<RadioGroup.Option
value="blob"
className="memori-settings-drawer--avatarType-radio-button"
>
{({ checked }) => (
<Button primary={checked} outlined={!checked}>
{t('write_and_speak.blob') || 'Blob'}
</Button>
)}
</RadioGroup.Option>
<RadioGroup.Option
value="avatar3d"
className="memori-settings-drawer--avatarType-radio-button"
>
{({ checked }) => (
<Button primary={checked} outlined={!checked}>
{t('write_and_speak.avatar3d') || 'Avatar 3D'}
</Button>
)}
</RadioGroup.Option>
</RadioGroup>
</div>
{isAvatar3d && (
<>
<div className="memori-settings-drawer--field controls">
<label htmlFor="#avatarControls" style={{ marginBottom: '1rem' }}>
{t('write_and_speak.avatarControls') || 'Avatar controls'}:
</label>

<label
htmlFor="avatarType"
className="memori-settings-drawer-label"
>
{t('write_and_speak.avatarType') || 'Avatar type'}:
</label>
<RadioGroup
id="avatarType"
name="avatarType"
value={avatarType}
defaultValue={avatarType}
className="memori-settings-drawer--avatarType-radio"
onChange={(value: any) => {
setAvatarType && setAvatarType(value);
setLocalConfig('avatarType', value);
}}
>
<RadioGroup.Option
value="blob"
className="memori-settings-drawer--avatarType-radio-button"
>
{({ checked }) => (
<Button primary={checked} outlined={!checked}>
{t('write_and_speak.blob') || 'Blob'}
</Button>
)}
</RadioGroup.Option>
<RadioGroup.Option
value="avatar3d"
className="memori-settings-drawer--avatarType-radio-button"
>
{({ checked }) => (
<Button primary={checked} outlined={!checked}>
{t('write_and_speak.avatar3d') || 'Avatar 3D'}
</Button>
)}
</RadioGroup.Option>
</RadioGroup>
</div>

<div className="memori-settings-drawer--field">
<Checkbox
label={
t('write_and_speak.enablePositionControls') ||
'Enable position controls'
}
name="enablePositionControls"
checked={enablePositionControls}
onChange={e => {
setEnablePositionControls(e.target.checked);
}}
/>
</div>
</>
)}

<div className="memori-settings-drawer--field">
<Checkbox
label={t('write_and_speak.enablePositionControls') || 'Enable position controls'}
name="enablePositionControls"
checked={enablePositionControls}
onChange={e => {
setEnablePositionControls(e.target.checked);
}}
/>
</div>
<div className="memori-settings-drawer--field">
<Checkbox
label={t('write_and_speak.hideEmissionsLabel') || 'Hide emissions'}
Expand Down

0 comments on commit d36b0de

Please sign in to comment.