Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions apps/member-profile/app/routes/_profile.offers.full-time.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -328,9 +328,19 @@ export default function FullTimeOffersPage() {
type FullTimeOfferInView = SerializeFrom<typeof loader>['offers'][number];

function FullTimeOffersTable() {
const { offers } = useLoaderData<typeof loader>();
const { appliedCompany, offers, totalOffers } =
useLoaderData<typeof loader>();
const [searchParams] = useSearchParams();

const hasOtherFilters =
!!searchParams.getAll('totalCompensation').length ||
!!searchParams.getAll('location').length;

const emptyMessage =
appliedCompany && !hasOtherFilters && totalOffers === 0
? `No record exists for full-time offers at ${appliedCompany.name} yet.`
: 'No full-time offers found matching the criteria.';

const columns: TableColumnProps<FullTimeOfferInView>[] = [
{
displayName: 'Company',
Expand Down Expand Up @@ -394,7 +404,7 @@ function FullTimeOffersTable() {
<Table
columns={columns}
data={offers}
emptyMessage="No full-time offers found matching the criteria."
emptyMessage={emptyMessage}
rowTo={({ id }) => {
return {
pathname: generatePath(Route['/offers/full-time/:id'], { id }),
Expand Down
14 changes: 12 additions & 2 deletions apps/member-profile/app/routes/_profile.offers.internships.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,19 @@ export default function InternshipOffersPage() {
type InternshipOfferInView = SerializeFrom<typeof loader>['offers'][number];

function InternshipOffersTable() {
const { offers } = useLoaderData<typeof loader>();
const { appliedCompany, offers, totalOffers } =
useLoaderData<typeof loader>();
const [searchParams] = useSearchParams();

const hasOtherFilters =
!!searchParams.getAll('hourlyRate').length ||
!!searchParams.getAll('location').length;

const emptyMessage =
appliedCompany && !hasOtherFilters && totalOffers === 0
? `No record exists for internship offers at ${appliedCompany.name} yet.`
: 'No internship offers found matching the criteria.';

const columns: TableColumnProps<InternshipOfferInView>[] = [
{
displayName: 'Company',
Expand Down Expand Up @@ -370,7 +380,7 @@ function InternshipOffersTable() {
<Table
columns={columns}
data={offers}
emptyMessage="No internship offers found matching the criteria."
emptyMessage={emptyMessage}
rowTo={({ id }) => {
return {
pathname: generatePath(Route['/offers/internships/:id'], { id }),
Expand Down
14 changes: 11 additions & 3 deletions apps/member-profile/app/routes/_profile.offers.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Outlet } from 'react-router';
import { Outlet, useSearchParams } from 'react-router';

import { cx, Dashboard } from '@oyster/ui';

Expand Down Expand Up @@ -27,14 +27,22 @@ type OffersNavigationProps = {
};

function OffersNavigation({ className }: OffersNavigationProps) {
const [searchParams] = useSearchParams();

const company = searchParams.get('company');

const search = company
? '?' + new URLSearchParams({ company }).toString()
: '';

return (
<nav className={cx('mr-auto', className)}>
<ul className="flex items-center gap-4">
<NavigationItem to={Route['/offers/internships']}>
<NavigationItem to={Route['/offers/internships'] + search}>
Internships
</NavigationItem>

<NavigationItem to={Route['/offers/full-time']}>
<NavigationItem to={Route['/offers/full-time'] + search}>
Full-Time
</NavigationItem>
</ul>
Expand Down
Loading