-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
32e23a4
commit 907e54d
Showing
5 changed files
with
59 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 12 additions & 4 deletions
16
src/frontend/src/pages/AdminToolsPage/EditGuestView/EditLogo.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,29 @@ | ||
import React from 'react'; | ||
import { useCurrentOrganization, useOrganizationLogo, useSetOrganizationLogo } from '../../../hooks/organizations.hooks'; | ||
import { useCurrentOrganization, useSetOrganizationLogo } from '../../../hooks/organizations.hooks'; | ||
import LoadingIndicator from '../../../components/LoadingIndicator'; | ||
import EditLogoForm from './EditLogoForm'; | ||
import { useToast } from '../../../hooks/toasts.hooks'; | ||
|
||
const EditLogo = () => { | ||
const { data: organization, isLoading: organizationIsLoading } = useCurrentOrganization(); | ||
const { mutateAsync } = useSetOrganizationLogo(); | ||
const { data: imageUrl } = useOrganizationLogo(); | ||
const toast = useToast(); | ||
|
||
if (organizationIsLoading || !organization) return <LoadingIndicator />; | ||
|
||
const onSubmitWrapper = async (logoImage: File) => { | ||
console.log('RECEIVED FILE'); | ||
try { | ||
await mutateAsync(logoImage); | ||
toast.success('Logo updated successfully!'); | ||
} catch (e) { | ||
if (e instanceof Error) { | ||
toast.error(e.message); | ||
} | ||
} | ||
await mutateAsync(logoImage); | ||
}; | ||
|
||
return <EditLogoForm logoImageUrl={imageUrl} onSubmit={onSubmitWrapper} />; | ||
return <EditLogoForm onSubmit={onSubmitWrapper} />; | ||
}; | ||
|
||
export default EditLogo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/frontend/src/pages/HomePage/components/LogoDisplay.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { Box } from '@mui/material'; | ||
import React from 'react'; | ||
import { useOrganizationLogo } from '../../../hooks/organizations.hooks'; | ||
import LoadingIndicator from '../../../components/LoadingIndicator'; | ||
|
||
const LogoDisplay = () => { | ||
const { data: imageUrl, isLoading } = useOrganizationLogo(); | ||
|
||
if (isLoading) return <LoadingIndicator />; | ||
|
||
return ( | ||
<Box | ||
component="img" | ||
src={imageUrl ?? '/logo.png'} | ||
sx={{ | ||
height: '100%', | ||
width: '100%', | ||
borderRadius: 2 | ||
}} | ||
/> | ||
); | ||
}; | ||
|
||
export default LogoDisplay; |