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
5 changes: 3 additions & 2 deletions backend/app/session/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -870,8 +870,9 @@ def handle_mark_roll_call(
state: SessionLiveState, event: schemas.MarkRollCallEvent, actor: SessionActor
) -> SessionLiveState:
require_chair(actor)
if state.current_state != States.ROLL_CALL or state.roll_call is None:
raise InvalidProceduralMove("Cannot mark roll call right now")
#removed these lines so chair can freely change the roll call
#if state.current_state != States.ROLL_CALL or state.roll_call is None:
# raise InvalidProceduralMove("Cannot mark roll call right now")

if event.payload.delegation_id not in state.delegations:
raise InvalidProceduralMove("Delegation does not exist")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import {
AlertDialogTitle,
AlertDialogTrigger,
} from "@/components/ui/alert-dialog"
import { DoorOpen } from "lucide-react"
import { DoorOpen, } from "lucide-react"
import { Link } from "react-router-dom"


export default function TestButton() {
Expand All @@ -34,7 +35,9 @@ export default function TestButton() {
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Cancelar</AlertDialogCancel>
<AlertDialogAction variant="destructive">Sair para a Dashboard</AlertDialogAction>
<AlertDialogAction variant="destructive" asChild>
<Link to="/dashboard">Sair para a Dashboard</Link>
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,9 @@ export default function TestButton() {
<Field>
<Select
value={selectedMotion}
onValueChange={(value : any) => {
if(motionKind === "moção") setSelectedMotion(value)
else if(motionKind === "questão") setSelectedQuestion(value)
onValueChange={(value : Motions | Questions | "") => {
if(motionKind === "moção") setSelectedMotion(value as Motions)
else if(motionKind === "questão") setSelectedQuestion(value as Questions | "")
setDebateKind("")
setUnmoderatedMinutes("")
setSpeechCount("")
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/session/delegation-map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
import { useCommitteeStore } from "@/store/useCommitteeStore"
import { CircleFlag } from 'react-circle-flags'
import { sendMessage } from "@/context/SessionContext"
import { type ChairInsertQueueEvent, type MarkRollCallEvent, type SpeakerEvent , ChairEvents, RollCallChoice } from "@/schemas/types.gen"
import { type AddGslSpeakerEvent, type MarkRollCallEvent, type GrantFloorEvent , ChairEvents, RollCallChoice } from "@/schemas/types.gen"
import {
Tooltip,
TooltipContent,
Expand Down Expand Up @@ -160,10 +160,10 @@ export default function DelegationMap({
<ContextMenuContent className="w-60">
<ContextMenuGroup>
<ContextMenuLabel>Ações sobre a Delegação</ContextMenuLabel>
<ContextMenuItem onClick={() => sendMessage({ type: ChairEvents.INSERT_QUEUE_EVENT, payload: { target: delegation.id } } satisfies ChairInsertQueueEvent)}>
<ContextMenuItem onClick={() => sendMessage({ type: ChairEvents.ADD_GSL_SPEAKER_EVENT, payload: { representation_id: delegation.id } } satisfies AddGslSpeakerEvent)}>
Colocar na Lista de Discursos
</ContextMenuItem>
<ContextMenuItem onClick={() => sendMessage({ type: ChairEvents.SPEAKER_EVENT, payload: { speaker_id: delegation.id } } satisfies SpeakerEvent)}>
<ContextMenuItem onClick={() => sendMessage({ type: ChairEvents.GRANT_FLOOR_EVENT, payload: { representation_id: delegation.id } } satisfies GrantFloorEvent)}>
Dar a palavra
</ContextMenuItem>
</ContextMenuGroup>
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/session/manual-quorum.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
} from "@/components/ui/item"
import { Separator } from "@/components/ui/separator"
import { CircleFlag } from 'react-circle-flags'
import { type MarkRollCallBulkEvent, ChairEvents, RollCallChoice } from "@/schemas/types.gen"
import { type MarkRollCallBulkEvent, ChairEvents, RollCallChoice, States } from "@/schemas/types.gen"


export default function ManualQuorum() {
Expand All @@ -41,13 +41,13 @@ export default function ManualQuorum() {

setTempQuorum(nextQuorum)
}

const currentState = useCommitteeStore((state) => state.current_state)

return (
<Dialog>
<form>
<DialogTrigger asChild>
<Button variant="outline" >
<Button variant="outline" disabled={currentState === States.SETUP_ROOM}>
Editar Quórum
</Button>
</DialogTrigger>
Expand Down
24 changes: 12 additions & 12 deletions frontend/src/components/session/motions-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@ import {
} from "@/components/ui/item"
import { Badge } from "@/components/ui/badge"
import Flags from "@/components/ui/flags"
import { sendMessage,useSession } from "@/context/SessionContext"
import { SessionRoles, ChairEvents, type ResolveMotionEvent} from "@/schemas/types.gen"
import { sendMessage, useSession } from "@/context/SessionContext"
import { SessionRoles, ChairEvents, type ResolveMotionEvent } from "@/schemas/types.gen"
import { useCommitteeStore } from "@/store/useCommitteeStore"


export default function MotionsList() {
const {role} = useSession()
const isChair = role===SessionRoles.CHAIR
const { role } = useSession()
const isChair = role === SessionRoles.CHAIR

const motions = useCommitteeStore((state)=>state.submitted_motions)!
const delegations = useCommitteeStore((state)=>state.delegations)
const motions = useCommitteeStore((state) => state.submitted_motions)!
const delegations = useCommitteeStore((state) => state.delegations)

const sortedMotions = [...motions].sort((a, b) => {
if(b.priority !== a.priority) return b.priority! - a.priority!
if (b.priority !== a.priority) return b.priority! - a.priority!

return new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime();
})
Expand All @@ -42,9 +42,9 @@ export default function MotionsList() {
<ItemMedia variant="icon" className="h-10 w-10 bg-neutral-200 rounded-full">
<div className="h-10 items-center justify-center flex">
<h2 className="font-bold text-black text-xs">{new Date(motion.timestamp).toLocaleTimeString('pt-BR', {
hour: '2-digit',
minute: '2-digit'
})}</h2>
hour: '2-digit',
minute: '2-digit'
})}</h2>
</div>
</ItemMedia>
<ItemContent>
Expand All @@ -58,9 +58,9 @@ export default function MotionsList() {
{isChair && (
<div className="flex items-center gap-2">
<Button size="sm" className="flex-1 bg-green-800 text-white hover:bg-green-700"
onClick={()=>sendMessage({type:ChairEvents.RESOLVE_MOTION_EVENT, payload:{motion_id:motion.id!, action:true }} satisfies ResolveMotionEvent)}>Acatar</Button>
onClick={() => sendMessage({ type: ChairEvents.RESOLVE_MOTION_EVENT, payload: { motion_id: motion.id!, action: true } } satisfies ResolveMotionEvent)}>Acatar</Button>
<Button size="sm" className="flex-1 bg-red-800 text-white hover:bg-red-700"
onClick={()=>sendMessage({type:ChairEvents.RESOLVE_MOTION_EVENT, payload:{motion_id:motion.id!, action:false }} satisfies ResolveMotionEvent)}>Rejeitar</Button>
onClick={() => sendMessage({ type: ChairEvents.RESOLVE_MOTION_EVENT, payload: { motion_id: motion.id!, action: false } } satisfies ResolveMotionEvent)}>Rejeitar</Button>
</div>
)}
<Separator />
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/session/speaker-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
TooltipTrigger,
} from "@/components/ui/tooltip"
import { sendMessage } from "@/context/SessionContext"
import { type JoinQueueEvent, type SpeakerEvent, ChairEvents, DelegateEvents } from "@/schemas/types.gen"
import { type JoinQueueEvent, type NextSpeakerEvent, ChairEvents, DelegateEvents } from "@/schemas/types.gen"
import { useSession } from "@/context/SessionContext"
import { SessionRoles } from "@/schemas/types.gen"

Expand Down Expand Up @@ -94,7 +94,7 @@ export default function SpeakerList() {
variant="outline"
className="flex-1 min-w-0 overflow-hidden text-ellipsis whitespace-nowrap"
disabled={waitingCount === 0}
onClick={() => sendMessage({ type: ChairEvents.SPEAKER_EVENT, payload: {} } satisfies SpeakerEvent)}
onClick={() => sendMessage({ type: ChairEvents.NEXT_SPEAKER_EVENT, payload: {} } satisfies NextSpeakerEvent)}
>
<span className="md:hidden">Proximo</span>
<span className="hidden md:inline">Proximo Orador</span>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/session/timer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
const isChair = role===SessionRoles.CHAIR
const delegations = useCommitteeStore((state) => state.delegations);
const currentSpeaker = useCommitteeStore((state) => state.current_speaker);
const speaker = currentSpeaker !== null && currentSpeaker !== undefined ? delegations[currentSpeaker] : {
let speaker = currentSpeaker !== null && currentSpeaker !== undefined ? delegations[currentSpeaker] : {

Check failure on line 18 in frontend/src/components/session/timer.tsx

View workflow job for this annotation

GitHub Actions / Frontend linting

'speaker' is never reassigned. Use 'const' instead
id: -1,
seat: "",
name: "Mesa",
Expand Down
8 changes: 7 additions & 1 deletion frontend/src/components/ui/flags.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import { useState } from "react"
import { useEffect, useState } from "react"
import { cn } from "@/lib/utils"

export default function Flags({
Expand All @@ -15,8 +15,14 @@ export default function Flags({
const [src, setSrc] = useState(baseSrc)
const [usedFallback, setUsedFallback] = useState(false)

useEffect(() => {
setSrc(baseSrc)
setUsedFallback(false)
}, [baseSrc])

return (
<img
key={normalized}
src={src}
alt={code}
className={cn(className)}
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/pages/Session.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import { SessionProvider } from '@/context/SessionContext.tsx';
import MotionsList from "@/components/session/motions-list"
import SpeakerList from "@/components/session/speaker-list"
//import ModeratedDebate from "@/components/session/moderated-debate"
//import UnmoderatedDebate from "@/components/session/unmoderated-debate"
import ModeratedDebate from "@/components/session/moderated-debate"

Check failure on line 7 in frontend/src/pages/Session.tsx

View workflow job for this annotation

GitHub Actions / Frontend linting

'ModeratedDebate' is defined but never used
import UnmoderatedDebate from "@/components/session/unmoderated-debate"

Check failure on line 8 in frontend/src/pages/Session.tsx

View workflow job for this annotation

GitHub Actions / Frontend linting

'UnmoderatedDebate' is defined but never used
import BottomBar from "@/components/session/bottom-bar"
import TopBar from '@/components/session/top-bar';
import DelegationMap from '@/components/session/delegation-map';
Expand All @@ -13,7 +13,7 @@

export default function SessionPage() {

const motions = [

Check failure on line 16 in frontend/src/pages/Session.tsx

View workflow job for this annotation

GitHub Actions / Frontend linting

'motions' is assigned a value but never used
{
id: "motion-1",
timestamp: "15:58",
Expand Down Expand Up @@ -78,7 +78,7 @@
//{debateType === DebateTypes.SPEAKERS_LIST && <SpeakerList />}
}
<SpeakerList />
<MotionsList motions={motions} />
<MotionsList />
</div>
</div>
<BottomBar />
Expand Down
Loading
Loading