From 0e02e230152f27e2785fe6290b979ae2461ef3f1 Mon Sep 17 00:00:00 2001
From: Zhang Ziqing <69516975+ziqing26@users.noreply.github.com>
Date: Thu, 17 Nov 2022 19:42:05 +0800
Subject: [PATCH] [offers][fix] add loading and fix ci (#554)
* [offers][fix] add check for loading
* [offers][fix] remove navbar
---
.../portal/src/components/global/AppShell.tsx | 7 +-
apps/portal/src/pages/offers/admin.tsx | 236 +++++++++---------
2 files changed, 123 insertions(+), 120 deletions(-)
diff --git a/apps/portal/src/components/global/AppShell.tsx b/apps/portal/src/components/global/AppShell.tsx
index 20bd1b53..7745efcc 100644
--- a/apps/portal/src/components/global/AppShell.tsx
+++ b/apps/portal/src/components/global/AppShell.tsx
@@ -157,9 +157,10 @@ export default function AppShell({ children }: Props) {
if (session == null) {
return OffersNavigation;
}
- return !isOffersAdminResultsLoading && isOffersAdmin
- ? OffersNavigationAdmin
- : OffersNavigationAuthenticated;
+ if (!isOffersAdminResultsLoading && isOffersAdmin) {
+ return OffersNavigationAdmin;
+ }
+ return OffersNavigationAuthenticated;
}
if (path.startsWith('/questions')) {
diff --git a/apps/portal/src/pages/offers/admin.tsx b/apps/portal/src/pages/offers/admin.tsx
index 5fc77224..2b6eca52 100644
--- a/apps/portal/src/pages/offers/admin.tsx
+++ b/apps/portal/src/pages/offers/admin.tsx
@@ -4,7 +4,7 @@ import Link from 'next/link';
import { useRouter } from 'next/router';
import { useState } from 'react';
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 OffersTable from '~/components/offers/admin/OffersTable';
@@ -52,127 +52,129 @@ export default function OffersHomePage({
if (!isLoading && !isAuthorized) {
router.push('/offers');
}
- return (
- isAuthorized && (
- <>
-
- Admin Home - Tech Offers Repo
-
-
-
- ⭐ Check if your offer is competitive by submitting it{' '}
-
- here
-
- . ⭐
-
-
-
-
-
- {
- if (option) {
- setCountryFilter(option.value);
- gaEvent({
- action: `offers.table_filter_country_${option.value}`,
- category: 'engagement',
- label: 'Filter by country',
- });
- } else {
- setCountryFilter('');
- }
- }}
- />
-
-
+ return isLoading ? (
+
+
+
+ ) : (
+ <>
+
+
Admin Home - Tech Offers Repo
+
+
+
+ ⭐ Check if your offer is competitive by submitting it{' '}
+
+ here
+
+ . ⭐
+
+
+
+
+
+ {
+ if (option) {
+ setCountryFilter(option.value);
+ gaEvent({
+ action: `offers.table_filter_country_${option.value}`,
+ category: 'engagement',
+ label: 'Filter by country',
+ });
+ } else {
+ setCountryFilter('');
+ }
+ }}
+ />
+
+
+
-
-
- Tech Offers Repo (Admin)
-
-
-
- Find out how good your offer is. Discover how others got their
- offers.
-
+
+ Tech Offers Repo (Admin)
+
+
+
+ Find out how good your offer is. Discover how others got their
+ offers.
-
-
Viewing offers for
-
-
+
+
Viewing offers for
+
+ {
+ if (option) {
+ setSelectedJobTitleId(option.id as JobTitleType);
+ gaEvent({
+ action: `offers.table_filter_job_title_${option.value}`,
+ category: 'engagement',
+ label: 'Filter by job title',
+ });
+ } else {
+ setSelectedJobTitleId(null);
}
- onSelect={(option) => {
- if (option) {
- setSelectedJobTitleId(option.id as JobTitleType);
- gaEvent({
- action: `offers.table_filter_job_title_${option.value}`,
- category: 'engagement',
- label: 'Filter by job title',
- });
- } else {
- setSelectedJobTitleId(null);
- }
- }}
- />
- in
-
+ in
+ {
+ if (option) {
+ setSelectedCompanyId(option.id);
+ setSelectedCompanyName(option.label);
+ gaEvent({
+ action: `offers.table_filter_company_${option.value}`,
+ category: 'engagement',
+ label: 'Filter by company',
+ });
+ } else {
+ setSelectedCompanyId('');
+ setSelectedCompanyName('');
}
- onSelect={(option) => {
- if (option) {
- setSelectedCompanyId(option.id);
- setSelectedCompanyName(option.label);
- gaEvent({
- action: `offers.table_filter_company_${option.value}`,
- category: 'engagement',
- label: 'Filter by company',
- });
- } else {
- setSelectedCompanyId('');
- setSelectedCompanyName('');
- }
- }}
- />
-
+ }}
+ />
-
-
-
-
- >
- )
+
+
+
+
+
+ >
);
}