Skip to content
Open
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
10 changes: 9 additions & 1 deletion packages/web/app/components/social/proposal-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import { VOTE_ON_PROPOSAL, RESOLVE_PROPOSAL, DELETE_PROPOSAL } from '@/app/lib/g
import type { Proposal } from '@boardsesh/shared-schema';
import type { Climb, BoardDetails, BoardName } from '@/app/lib/types';
import ClimbListItem from '@/app/components/climb-card/climb-list-item';
import { useOptionalQueueContext } from '@/app/components/graphql-queue';
import { convertLitUpHoldsStringToMap } from '@/app/components/board-renderer/util';
import { getBoardDetailsForBoard } from '@/app/lib/board-utils';
import { getDefaultBoardConfig } from '@/app/lib/default-board-configs';
Expand Down Expand Up @@ -61,6 +62,7 @@ interface ProposalCardProps {

export default function ProposalCard({ proposal, isAdminOrLeader, onUpdate, onDelete, highlight }: ProposalCardProps) {
const { token } = useWsAuthToken();
const queueContext = useOptionalQueueContext();
const [loading, setLoading] = useState(false);
const [snackbar, setSnackbar] = useState('');
const [localProposal, setLocalProposal] = useState(proposal);
Expand Down Expand Up @@ -174,6 +176,12 @@ export default function ProposalCard({ proposal, isAdminOrLeader, onUpdate, onDe
return { climb, boardDetails };
}, [localProposal]);

const handleSetActive = useCallback(() => {
if (climbAndBoardDetails && queueContext) {
queueContext.setCurrentClimb(climbAndBoardDetails.climb);
}
}, [climbAndBoardDetails, queueContext]);

const typeColor = TYPE_COLORS[localProposal.type] || themeTokens.neutral[500];

return (
Expand All @@ -195,7 +203,7 @@ export default function ProposalCard({ proposal, isAdminOrLeader, onUpdate, onDe
<ClimbListItem
climb={climbAndBoardDetails.climb}
boardDetails={climbAndBoardDetails.boardDetails}
disableSwipe
onSelect={queueContext ? handleSetActive : undefined}
/>
)}

Expand Down
Loading