Skip to content

Commit

Permalink
refactor: lint and format
Browse files Browse the repository at this point in the history
  • Loading branch information
thulioqueiroz authored and Tymek committed Aug 9, 2024
1 parent 7f41a2d commit 96222f2
Show file tree
Hide file tree
Showing 390 changed files with 12,721 additions and 11,283 deletions.
89 changes: 45 additions & 44 deletions frontend/src/component/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,55 +48,56 @@ export const App = () => {
}, [authDetails, user]);

return (
(<SWRProvider>
<SWRProvider>
<Suspense fallback={<Loader type='fullscreen' />}>
{!hasFetchedAuth ? <Loader type='fullscreen' /> : <Demo>
<>
{Boolean(
uiConfig?.maintenanceMode,
) ? <MaintenanceBanner /> : null}
<LicenseBanner />
<ExternalBanners />
<InternalBanners />
<EdgeUpgradeBanner />
<StyledContainer>
<ToastRenderer />
<Routes>
{availableRoutes.map((route) => (
{!hasFetchedAuth ? (
<Loader type='fullscreen' />
) : (
<Demo>
<>
{uiConfig?.maintenanceMode ? (
<MaintenanceBanner />
) : null}
<LicenseBanner />
<ExternalBanners />
<InternalBanners />
<EdgeUpgradeBanner />
<StyledContainer>
<ToastRenderer />
<Routes>
{availableRoutes.map((route) => (
<Route
key={route.path}
path={route.path}
element={
<LayoutPicker
isStandalone={
route.isStandalone ===
true
}
>
<ProtectedRoute
route={route}
/>
</LayoutPicker>
}
/>
))}
<Route
key={route.path}
path={route.path}
element={
<LayoutPicker
isStandalone={
route.isStandalone ===
true
}
>
<ProtectedRoute
route={route}
/>
</LayoutPicker>
}
path='/'
element={<InitialRedirect />}
/>
))}
<Route
path='/'
element={<InitialRedirect />}
/>
<Route
path='*'
element={<NotFound />}
/>
</Routes>
<Route path='*' element={<NotFound />} />
</Routes>

<FeedbackNPS openUrl='http://feedback.unleash.run' />
<FeedbackNPS openUrl='http://feedback.unleash.run' />

<SplashPageRedirect />
</StyledContainer>
</>
</Demo>}
<SplashPageRedirect />
</StyledContainer>
</>
</Demo>
)}
</Suspense>
</SWRProvider>)
</SWRProvider>
);
};
58 changes: 30 additions & 28 deletions frontend/src/component/admin/Admin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,32 +25,34 @@ import { useUiFlag } from 'hooks/useUiFlag';
export const Admin = () => {
const sidebarNavigationEnabled = useUiFlag('navigationSidebar');

return (<>
{!sidebarNavigationEnabled ? <AdminTabsMenu /> : null}
<Routes>
<Route index element={<AdminIndex />} />
<Route path='users/*' element={<UsersAdmin />} />
<Route path='api' element={<ApiTokenPage />} />
<Route path='api/create-token' element={<CreateApiToken />} />
<Route path='service-accounts' element={<ServiceAccounts />} />
<Route path='create-user' element={<CreateUser />} />
<Route path='invite-link' element={<InviteLink />} />
<Route path='groups/*' element={<GroupsAdmin />} />
<Route path='roles/*' element={<Roles />} />
<Route path='instance' element={<InstanceAdmin />} />
<Route path='network/*' element={<Network />} />
<Route path='maintenance' element={<MaintenanceAdmin />} />
<Route path='banners' element={<Banners />} />
<Route path='license' element={<License />} />
<Route path='cors' element={<CorsAdmin />} />
<Route path='auth' element={<AuthSettings />} />
<Route
path='admin-invoices'
element={<FlaggedBillingRedirect />}
/>
<Route path='billing' element={<Billing />} />
<Route path='instance-privacy' element={<InstancePrivacy />} />
<Route path='*' element={<NotFound />} />
</Routes>
</>);
return (
<>
{!sidebarNavigationEnabled ? <AdminTabsMenu /> : null}
<Routes>
<Route index element={<AdminIndex />} />
<Route path='users/*' element={<UsersAdmin />} />
<Route path='api' element={<ApiTokenPage />} />
<Route path='api/create-token' element={<CreateApiToken />} />
<Route path='service-accounts' element={<ServiceAccounts />} />
<Route path='create-user' element={<CreateUser />} />
<Route path='invite-link' element={<InviteLink />} />
<Route path='groups/*' element={<GroupsAdmin />} />
<Route path='roles/*' element={<Roles />} />
<Route path='instance' element={<InstanceAdmin />} />
<Route path='network/*' element={<Network />} />
<Route path='maintenance' element={<MaintenanceAdmin />} />
<Route path='banners' element={<Banners />} />
<Route path='license' element={<License />} />
<Route path='cors' element={<CorsAdmin />} />
<Route path='auth' element={<AuthSettings />} />
<Route
path='admin-invoices'
element={<FlaggedBillingRedirect />}
/>
<Route path='billing' element={<Billing />} />
<Route path='instance-privacy' element={<InstancePrivacy />} />
<Route path='*' element={<NotFound />} />
</Routes>
</>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,22 @@ const ApiTokenForm: React.FC<IApiTokenFormProps> = ({
const isUnleashCloud = Boolean(uiConfig?.flags?.UNLEASH_CLOUD);

return (
(<StyledForm onSubmit={handleSubmit}>
{isUnleashCloud ? <Alert severity='info' sx={{ mb: 4 }}>
Please be aware of our{' '}
<Link href='https://www.getunleash.io/fair-use-policy'>
fair use policy
</Link>
.
</Alert> : null}
<StyledForm onSubmit={handleSubmit}>
{isUnleashCloud ? (
<Alert severity='info' sx={{ mb: 4 }}>
Please be aware of our{' '}
<Link href='https://www.getunleash.io/fair-use-policy'>
fair use policy
</Link>
.
</Alert>
) : null}
{children}
<StyledBox>
{actions}
<CancelButton onClick={handleCancel}>Cancel</CancelButton>
</StyledBox>
</StyledForm>)
</StyledForm>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,12 @@ export const SelectProjectInput: VFC<ISelectProjectInputProps> = ({

const renderGroup = ({ key, children }: AutocompleteRenderGroupParams) => (
<Fragment key={key}>
{options.length > 2 ? <SelectAllButton
isAllSelected={isAllSelected}
onClick={onSelectAllClick}
/> : null}
{options.length > 2 ? (
<SelectAllButton
isAllSelected={isAllSelected}
onClick={onSelectAllClick}
/>
) : null}
{children}
</Fragment>
);
Expand Down
24 changes: 13 additions & 11 deletions frontend/src/component/admin/apiToken/ConfirmToken/ConfirmToken.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const ConfirmToken = ({
type,
}: IConfirmUserLink) => {
return (
(<Dialogue
<Dialogue
open={open}
setOpen={setOpen}
onClick={closeConfirm}
Expand All @@ -31,15 +31,17 @@ export const ConfirmToken = ({
Your new token has been created successfully.
</Typography>
<UserToken token={token} />
{type === TokenType.FRONTEND ? <Alert sx={{ mt: 2 }} severity='info'>
By default, all {TokenType.FRONTEND} tokens may be used
from any CORS origin. If you'd like to configure a
strict set of origins, please use the{' '}
<Link to='/admin/cors' target='_blank' rel='noreferrer'>
CORS origins configuration page
</Link>
.
</Alert> : null}
</Dialogue>)
{type === TokenType.FRONTEND ? (
<Alert sx={{ mt: 2 }} severity='info'>
By default, all {TokenType.FRONTEND} tokens may be used from
any CORS origin. If you'd like to configure a strict set of
origins, please use the{' '}
<Link to='/admin/cors' target='_blank' rel='noreferrer'>
CORS origins configuration page
</Link>
.
</Alert>
) : null}
</Dialogue>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export const CreateApiToken = ({ modal = false }: ICreateApiTokenProps) => {
};

return (
(<FormTemplate
<FormTemplate
loading={loadingCreateToken}
title={pageTitle}
modal={modal}
Expand Down Expand Up @@ -175,12 +175,14 @@ export const CreateApiToken = ({ modal = false }: ICreateApiTokenProps) => {
environment={environment}
setEnvironment={setEnvironment}
/>
{resourceLimitsEnabled ? <StyledLimit
name='API tokens'
shortName='tokens'
currentValue={currentValue}
limit={limit}
/> : null}
{resourceLimitsEnabled ? (
<StyledLimit
name='API tokens'
shortName='tokens'
currentValue={currentValue}
limit={limit}
/>
) : null}
</ApiTokenForm>
<ConfirmToken
open={showConfirm}
Expand All @@ -189,6 +191,6 @@ export const CreateApiToken = ({ modal = false }: ICreateApiTokenProps) => {
token={token}
type={type}
/>
</FormTemplate>)
</FormTemplate>
);
};
Loading

0 comments on commit 96222f2

Please sign in to comment.