Skip to content

Commit

Permalink
feat: xpress call filter load active call by default (#959)
Browse files Browse the repository at this point in the history
  • Loading branch information
deepaksftc authored Feb 24, 2025
1 parent a489606 commit 228e50e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
19 changes: 17 additions & 2 deletions apps/frontend/src/components/menu/MenuItems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { TimeSpan } from 'components/experiment/PresetDateSelector';
import { FeatureContext } from 'context/FeatureContextProvider';
import { FeatureId, SettingsId, UserRole } from 'generated/sdk';
import { useFormattedDateTime } from 'hooks/admin/useFormattedDateTime';
import { CallsDataQuantity, useCallsData } from 'hooks/call/useCallsData';
import { useXpressAccess } from 'hooks/common/useXpressAccess';

import SettingsMenuListItem from './SettingsMenuListItem';
Expand Down Expand Up @@ -91,6 +92,20 @@ const MenuItems = ({ currentRole }: MenuItemsProps) => {
UserRole.INSTRUMENT_SCIENTIST,
]);

const calls = useCallsData(
{
proposalStatusShortCode: 'QUICK_REVIEW',
},
CallsDataQuantity.MINIMAL
).calls;

const openCall = calls?.find((call) => call.isActive);

const xpressUrl =
openCall && openCall.id
? `/XpressProposals?call=${openCall?.id}`
: '/XpressProposals';

const { from, to } = getRelativeDatesFromToday(TimeSpan.NEXT_30_DAYS);

const formattedDate = (value?: Date) =>
Expand Down Expand Up @@ -150,7 +165,7 @@ const MenuItems = ({ currentRole }: MenuItemsProps) => {
</Tooltip>
{isXpressRouteEnabled && (
<Tooltip title="Xpress Proposals">
<ListItemButton component={NavLink} to="/XpressProposals">
<ListItemButton component={NavLink} to={xpressUrl}>
<ListItemIcon>
<Topic />
</ListItemIcon>
Expand Down Expand Up @@ -287,7 +302,7 @@ const MenuItems = ({ currentRole }: MenuItemsProps) => {
<ListItemText primary="Proposals" />
</ListItemButton>
{isXpressRouteEnabled && (
<ListItemButton component={NavLink} to="/XpressProposals">
<ListItemButton component={NavLink} to={xpressUrl}>
<ListItemIcon>
<Topic />
</ListItemIcon>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const XpressProposalTable = ({ confirm }: { confirm: WithConfirmType }) => {

const isUserOfficer = useCheckAccess([UserRole.USER_OFFICER]);

const callId = searchParams.get('callId');
const callId = searchParams.get('call');
const instrument = searchParams.get('instrument');
const technique = searchParams.get('technique');
const proposalId = searchParams.get('proposalId');
Expand Down
1 change: 1 addition & 0 deletions apps/frontend/src/graphql/call/getCallsMinimal.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ query getCallsMinimal($filter: CallsFilter) {
description
cycleComment
allocationTimeUnit
isActive
}
}

0 comments on commit 228e50e

Please sign in to comment.