diff --git a/apps/portal/src/components/global/AppShell.tsx b/apps/portal/src/components/global/AppShell.tsx
index 6c9a7469..20bd1b53 100644
--- a/apps/portal/src/components/global/AppShell.tsx
+++ b/apps/portal/src/components/global/AppShell.tsx
@@ -11,11 +11,14 @@ import { Button } from '@tih/ui';
import GlobalNavigation from '~/components/global/GlobalNavigation';
import HomeNavigation from '~/components/global/HomeNavigation';
import OffersNavigation, {
+ OffersNavigationAdmin,
OffersNavigationAuthenticated,
} from '~/components/offers/OffersNavigation';
import QuestionsNavigation from '~/components/questions/QuestionsNavigation';
import ResumesNavigation from '~/components/resumes/ResumesNavigation';
+import { trpc } from '~/utils/trpc';
+
import GoogleAnalytics from './GoogleAnalytics';
import MobileNavigation from './MobileNavigation';
import type { ProductNavigationItems } from './ProductNavigation';
@@ -131,7 +134,12 @@ export default function AppShell({ children }: Props) {
const [mobileMenuOpen, setMobileMenuOpen] = useState(false);
const router = useRouter();
const { data: session } = useSession();
-
+ const { isLoading: isOffersAdminResultsLoading, data: isOffersAdmin } =
+ trpc.useQuery(['offers.admin.isAdmin'], {
+ onError: () => {
+ router.push('/offers');
+ },
+ });
const currentProductNavigation: Readonly<{
googleAnalyticsMeasurementID: string;
logo?: React.ReactNode;
@@ -149,7 +157,9 @@ export default function AppShell({ children }: Props) {
if (session == null) {
return OffersNavigation;
}
- return OffersNavigationAuthenticated;
+ return !isOffersAdminResultsLoading && isOffersAdmin
+ ? OffersNavigationAdmin
+ : OffersNavigationAuthenticated;
}
if (path.startsWith('/questions')) {
diff --git a/apps/portal/src/components/offers/OffersNavigation.tsx b/apps/portal/src/components/offers/OffersNavigation.tsx
index 53e4b4c8..467f7785 100644
--- a/apps/portal/src/components/offers/OffersNavigation.tsx
+++ b/apps/portal/src/components/offers/OffersNavigation.tsx
@@ -13,6 +13,14 @@ const navigationAuthenticated: ProductNavigationItems = [
{ href: '/offers/about', name: 'About' },
];
+const navigationAdmin: ProductNavigationItems = [
+ { href: '/offers/submit', name: 'Analyze your offers' },
+ { href: '/offers/dashboard', name: 'My dashboard' },
+ { href: '/offers/features', name: 'Features' },
+ { href: '/offers/about', name: 'About' },
+ { href: '/offers/admin', name: 'Admin' },
+];
+
const config = {
googleAnalyticsMeasurementID: 'G-34XRGLEVCF',
logo: (
@@ -28,6 +36,11 @@ const config = {
titleHref: '/offers',
};
+export const OffersNavigationAdmin = {
+ ...config,
+ navigation: navigationAdmin,
+};
+
export const OffersNavigationAuthenticated = {
...config,
navigation: navigationAuthenticated,
diff --git a/apps/portal/src/components/offers/admin_temp/OffersHeader.tsx b/apps/portal/src/components/offers/admin/OffersHeader.tsx
similarity index 97%
rename from apps/portal/src/components/offers/admin_temp/OffersHeader.tsx
rename to apps/portal/src/components/offers/admin/OffersHeader.tsx
index 99ce8143..9754178e 100644
--- a/apps/portal/src/components/offers/admin_temp/OffersHeader.tsx
+++ b/apps/portal/src/components/offers/admin/OffersHeader.tsx
@@ -1,10 +1,10 @@
import clsx from 'clsx';
-import type { OfferTableSortType } from '~/components/offers/admin_temp/types';
+import type { OfferTableSortType } from '~/components/offers/admin/types';
import {
getOppositeSortOrder,
OFFER_TABLE_SORT_ORDER,
-} from '~/components/offers/admin_temp/types';
+} from '~/components/offers/admin/types';
export type OffersTableHeaderProps = Readonly<{
header: string;
diff --git a/apps/portal/src/components/offers/admin_temp/OffersRow.tsx b/apps/portal/src/components/offers/admin/OffersRow.tsx
similarity index 100%
rename from apps/portal/src/components/offers/admin_temp/OffersRow.tsx
rename to apps/portal/src/components/offers/admin/OffersRow.tsx
diff --git a/apps/portal/src/components/offers/admin_temp/OffersTable.tsx b/apps/portal/src/components/offers/admin/OffersTable.tsx
similarity index 94%
rename from apps/portal/src/components/offers/admin_temp/OffersTable.tsx
rename to apps/portal/src/components/offers/admin/OffersTable.tsx
index 56b1d81e..4058907c 100644
--- a/apps/portal/src/components/offers/admin_temp/OffersTable.tsx
+++ b/apps/portal/src/components/offers/admin/OffersTable.tsx
@@ -4,20 +4,20 @@ import { JobType } from '@prisma/client';
import { DropdownMenu, Spinner, useToast } from '@tih/ui';
import { useGoogleAnalytics } from '~/components/global/GoogleAnalytics';
-import OffersRow from '~/components/offers/admin_temp//OffersRow';
-import OffersHeader from '~/components/offers/admin_temp/OffersHeader';
-import OffersTablePagination from '~/components/offers/admin_temp/OffersTablePagination';
+import OffersHeader from '~/components/offers/admin/OffersHeader';
+import OffersRow from '~/components/offers/admin/OffersRow';
+import OffersTablePagination from '~/components/offers/admin/OffersTablePagination';
import type {
OfferTableColumn,
OfferTableSortType,
-} from '~/components/offers/admin_temp/types';
+} from '~/components/offers/admin/types';
import {
FullTimeOfferTableColumns,
InternOfferTableColumns,
OFFER_TABLE_SORT_ORDER,
OfferTableYoeOptions,
YOE_CATEGORY_PARAM,
-} from '~/components/offers/admin_temp/types';
+} from '~/components/offers/admin/types';
import { getCurrencyForCountry } from '~/utils/offers/currency/CurrencyEnum';
import CurrencySelector from '~/utils/offers/currency/CurrencySelector';
@@ -294,12 +294,11 @@ export default function OffersTable({