[offers][fix] add loading and fix ci (#554)

* [offers][fix] add check for loading

* [offers][fix] remove navbar
pull/556/head
Zhang Ziqing 3 years ago committed by GitHub
parent 8e53e8dd4d
commit 0e02e23015
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -157,9 +157,10 @@ export default function AppShell({ children }: Props) {
if (session == null) { if (session == null) {
return OffersNavigation; return OffersNavigation;
} }
return !isOffersAdminResultsLoading && isOffersAdmin if (!isOffersAdminResultsLoading && isOffersAdmin) {
? OffersNavigationAdmin return OffersNavigationAdmin;
: OffersNavigationAuthenticated; }
return OffersNavigationAuthenticated;
} }
if (path.startsWith('/questions')) { if (path.startsWith('/questions')) {

@ -4,7 +4,7 @@ import Link from 'next/link';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import { useState } from 'react'; import { useState } from 'react';
import { MapPinIcon } from '@heroicons/react/24/outline'; import { MapPinIcon } from '@heroicons/react/24/outline';
import { Banner } from '@tih/ui'; import { Banner, Spinner } from '@tih/ui';
import { useGoogleAnalytics } from '~/components/global/GoogleAnalytics'; import { useGoogleAnalytics } from '~/components/global/GoogleAnalytics';
import OffersTable from '~/components/offers/admin/OffersTable'; import OffersTable from '~/components/offers/admin/OffersTable';
@ -52,8 +52,11 @@ export default function OffersHomePage({
if (!isLoading && !isAuthorized) { if (!isLoading && !isAuthorized) {
router.push('/offers'); router.push('/offers');
} }
return ( return isLoading ? (
isAuthorized && ( <div className="flex justify-center py-32">
<Spinner display="block" size="lg" />
</div>
) : (
<> <>
<Head> <Head>
<title>Admin Home - Tech Offers Repo</title> <title>Admin Home - Tech Offers Repo</title>
@ -173,6 +176,5 @@ export default function OffersHomePage({
</Container> </Container>
</main> </main>
</> </>
)
); );
} }

Loading…
Cancel
Save