- {/*
+
+
+ {/*
{status}
{sessionStart ? `${uptime}s` : "Waiting for session..."}
*/}
-
-
-
-
-
-
-
- {//{debateType === DebateTypes.UNMODERATED_DEBATE &&
}
- //{debateType === DebateTypes.MODERATED_DEBATE &&
}
- //{debateType === DebateTypes.SPEAKERS_LIST &&
}
- }
-
-
+
+
+
+
+
+
+
+ {currentState === States.SETUP_ROOM &&
}
+ {currentState === States.OPEN_GSL &&
}
+ {currentState === States.MODERATED_CAUCUS &&
}
+ {currentState === States.UNMODERATED_CAUCUS &&
}
+ {currentState === States.VOTING_EXECUTION &&
}
+ {currentState !== States.SETUP_ROOM &&
}
+
+
+
-
-
-
+
);
}
From 1bda07bd8b97a80a59cce14b42653ceb252a6833 Mon Sep 17 00:00:00 2001
From: Le-frances13 <100540487+Le-frances13@users.noreply.github.com>
Date: Sun, 23 Aug 2026 22:35:54 -0300
Subject: [PATCH 02/39] feat: Many UI Improvements
---
.../{ => Sidebar}/moderated-debate.tsx | 2 +-
.../session/{ => Sidebar}/motions-list.tsx | 0
.../components/session/Sidebar/roll_calll.tsx | 116 ++++++++++++++++++
.../session/{ => Sidebar}/speaker-list.tsx | 0
.../{ => Sidebar}/unmoderated-debate.tsx | 0
frontend/src/components/session/timer.tsx | 2 +-
frontend/src/components/ui/spinner.tsx | 10 ++
7 files changed, 128 insertions(+), 2 deletions(-)
rename frontend/src/components/session/{ => Sidebar}/moderated-debate.tsx (98%)
rename frontend/src/components/session/{ => Sidebar}/motions-list.tsx (100%)
create mode 100644 frontend/src/components/session/Sidebar/roll_calll.tsx
rename frontend/src/components/session/{ => Sidebar}/speaker-list.tsx (100%)
rename frontend/src/components/session/{ => Sidebar}/unmoderated-debate.tsx (100%)
create mode 100644 frontend/src/components/ui/spinner.tsx
diff --git a/frontend/src/components/session/moderated-debate.tsx b/frontend/src/components/session/Sidebar/moderated-debate.tsx
similarity index 98%
rename from frontend/src/components/session/moderated-debate.tsx
rename to frontend/src/components/session/Sidebar/moderated-debate.tsx
index b5b5b73..eeefb8e 100644
--- a/frontend/src/components/session/moderated-debate.tsx
+++ b/frontend/src/components/session/Sidebar/moderated-debate.tsx
@@ -37,7 +37,7 @@ export default function ModeratedDebate() {
Debate Moderado
-
Historico de Oradores:
+
Historico de Oradores:
{queuedDelegations.map((delegate, index) => {
diff --git a/frontend/src/components/session/motions-list.tsx b/frontend/src/components/session/Sidebar/motions-list.tsx
similarity index 100%
rename from frontend/src/components/session/motions-list.tsx
rename to frontend/src/components/session/Sidebar/motions-list.tsx
diff --git a/frontend/src/components/session/Sidebar/roll_calll.tsx b/frontend/src/components/session/Sidebar/roll_calll.tsx
new file mode 100644
index 0000000..3625429
--- /dev/null
+++ b/frontend/src/components/session/Sidebar/roll_calll.tsx
@@ -0,0 +1,116 @@
+import { Button } from "@/components/ui/button"
+import { Separator } from "@/components/ui/separator"
+import { ScrollArea } from "@/components/ui/scroll-area"
+import {
+ Item,
+ ItemContent,
+ ItemMedia,
+ ItemTitle,
+} from "@/components/ui/item"
+import Flags from "@/components/ui/flags"
+import { useCommitteeStore } from "@/store/useCommitteeStore"
+import {Badge} from "@/components/ui/badge"
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
+} from "@/components/ui/tooltip"
+import { useSession } from "@/context/SessionContext"
+import { SessionRoles, RollCallChoice, VotingChoice, MajorityTypes} from "@/schemas/types.gen"
+
+//TODO determine if queue is open, if not obscure the button and show a message that the queue is closed
+
+export default function VotingMenu() {
+
+ const voteTitle = useCommitteeStore((state) => state.voting?.motion_in_vote?.type ?? "ERROR:VotingTitle not found")
+
+
+ const expectedVotes = useCommitteeStore((state) => Object.entries(state.roll_call?.registry ?? {}).filter(([, choice]) => choice !== RollCallChoice.ABSENT).length)
+ const yayVotes = useCommitteeStore((state) => Object.entries(state.voting?.voting_registry ?? {}).filter(([, choice]) => choice === VotingChoice.FAVOUR).length)
+ const nayVotes = useCommitteeStore((state) => Object.entries(state.voting?.voting_registry ?? {}).filter(([, choice]) => choice === VotingChoice.AGAINST).length)
+ const abstentions = useCommitteeStore((state) => Object.entries(state.voting?.voting_registry ?? {}).filter(([, choice]) => choice === VotingChoice.ABSTAIN).length)
+ const majorityType = useCommitteeStore((state) => state.voting?.majority ?? MajorityTypes.MAIORIA_SIMPLES)
+ const requiredMajority = majorityType === MajorityTypes.MAIORIA_QUALIFICADA
+ ? Math.ceil(expectedVotes * 2 / 3)
+ : majorityType === MajorityTypes.CONSENSO
+ ? expectedVotes
+ : Math.floor(expectedVotes / 2) + 1
+
+
+ const {role} = useSession()
+ const isChair = role===SessionRoles.CHAIR
+
+ const votedCount = yayVotes + nayVotes + abstentions
+ const pendingVotes = expectedVotes - votedCount
+ const majorityPosition = expectedVotes
+ ? Math.min(100, Math.max(0, (requiredMajority / expectedVotes) * 100))
+ : 0
+
+
+ return (
+
+
+
Votação em progresso
+
{voteTitle}
+
+
+
Resultados parciais:
+
Votaram {votedCount} de {expectedVotes} delegações
+
+
+
+
+ Sim: {yayVotes}
+ Abstenção: {abstentions}
+ Não: {nayVotes}
+
+
{majorityType}: {requiredMajority} votos
+
+
+ {isChair && (
+
+
+ Encerrar votação
+
+
+
+ )}
+
+
+
)
+}
diff --git a/frontend/src/components/session/speaker-list.tsx b/frontend/src/components/session/Sidebar/speaker-list.tsx
similarity index 100%
rename from frontend/src/components/session/speaker-list.tsx
rename to frontend/src/components/session/Sidebar/speaker-list.tsx
diff --git a/frontend/src/components/session/unmoderated-debate.tsx b/frontend/src/components/session/Sidebar/unmoderated-debate.tsx
similarity index 100%
rename from frontend/src/components/session/unmoderated-debate.tsx
rename to frontend/src/components/session/Sidebar/unmoderated-debate.tsx
diff --git a/frontend/src/components/session/timer.tsx b/frontend/src/components/session/timer.tsx
index e6184cf..6693a67 100644
--- a/frontend/src/components/session/timer.tsx
+++ b/frontend/src/components/session/timer.tsx
@@ -15,7 +15,7 @@ export default function Timer() {
const isChair = role===SessionRoles.CHAIR
const delegations = useCommitteeStore((state) => state.delegations);
const currentSpeaker = useCommitteeStore((state) => state.current_speaker);
- let speaker = currentSpeaker !== null && currentSpeaker !== undefined ? delegations[currentSpeaker] : {
+ const speaker = currentSpeaker !== null && currentSpeaker !== undefined ? delegations[currentSpeaker] : {
id: -1,
seat: "",
name: "Mesa",
diff --git a/frontend/src/components/ui/spinner.tsx b/frontend/src/components/ui/spinner.tsx
new file mode 100644
index 0000000..8dca22b
--- /dev/null
+++ b/frontend/src/components/ui/spinner.tsx
@@ -0,0 +1,10 @@
+import { cn } from "@/lib/utils"
+import { Loader2Icon } from "lucide-react"
+
+function Spinner({ className, ...props }: React.ComponentProps<"svg">) {
+ return (
+
+ )
+}
+
+export { Spinner }
From 9fd4c0905c3b3a39081fa860d94499c62da1e9d9 Mon Sep 17 00:00:00 2001
From: Le-frances13 <100540487+Le-frances13@users.noreply.github.com>
Date: Mon, 24 Aug 2026 08:33:06 -0300
Subject: [PATCH 03/39] feat: motion dialog closes afther sending motion
---
.../bottom-bar-buttons/MotionsButton.tsx | 115 ++++++++++--------
1 file changed, 66 insertions(+), 49 deletions(-)
diff --git a/frontend/src/components/session/bottom-bar-buttons/MotionsButton.tsx b/frontend/src/components/session/bottom-bar-buttons/MotionsButton.tsx
index f9ee6c6..98859df 100644
--- a/frontend/src/components/session/bottom-bar-buttons/MotionsButton.tsx
+++ b/frontend/src/components/session/bottom-bar-buttons/MotionsButton.tsx
@@ -1,5 +1,6 @@
import {
Dialog,
+ DialogClose,
DialogContent,
DialogDescription,
DialogHeader,
@@ -42,15 +43,16 @@ import { useCommitteeStore } from "@/store/useCommitteeStore"
import { MajorityTypes, States } from "@/schemas/types.gen"
import { useSession } from "@/context/SessionContext"
import { SessionRoles } from "@/schemas/types.gen"
-import {
- Motions,
- Questions,
+import {
+ Motions,
+ Questions,
DebateTypes,
DelegateEvents,
- type SubmitMotionEvent,
- type SubmitQuestionEvent,
+ type SubmitMotionEvent,
+ type SubmitQuestionEvent,
type DelegateQuestionPayload,
- type DelegateMotionPayload } from "@/schemas/types.gen"
+ type DelegateMotionPayload
+} from "@/schemas/types.gen"
import { sendMessage } from "@/context/SessionContext"
const motionRequiredMajority: Record = {
@@ -79,8 +81,8 @@ function QuestionsMotionsList(type: MotionKind) {
export default function TestButton() {
- const {role} = useSession()
- const isChair = role===SessionRoles.CHAIR
+ const { role } = useSession()
+ const isChair = role === SessionRoles.CHAIR
const currentState = useCommitteeStore((state) => state.current_state)
const [motionKind, setMotionKind] = useState("moção")
@@ -101,22 +103,22 @@ export default function TestButton() {
const showMotionDecision = motionKind === "moção" && selectedMotion.length > 0
const selectedMotionMajority = motionRequiredMajority[selectedMotion] ?? "Maioria não definida"
- const motionBody : DelegateMotionPayload = {
+ const motionBody: DelegateMotionPayload = {
type: selectedMotion,
- ...(unmoderatedMinutes !== "" && {total_duration_minutes: Number(unmoderatedMinutes)}),
- ...(minutesPerSpeech !== "" && {per_speaker_seconds: Number(minutesPerSpeech)}), //TODO: Fix inconsitency in minutes / seconds
- ...(debateKindChange !== "" && {debate_type: debateKindChange}),
- ...(minutesPerSpeech !== "" && {per_speaker_seconds: Number(minutesPerSpeech)}),
+ ...(unmoderatedMinutes !== "" && { total_duration_minutes: Number(unmoderatedMinutes) }),
+ ...(minutesPerSpeech !== "" && { per_speaker_seconds: Number(minutesPerSpeech) }), //TODO: Fix inconsitency in minutes / seconds
+ ...(debateKindChange !== "" && { debate_type: debateKindChange }),
+ ...(minutesPerSpeech !== "" && { per_speaker_seconds: Number(minutesPerSpeech) }),
//TODO: add change topic
}
- const questionBody : DelegateQuestionPayload | null =
- selectedQuestion === "" ? null :
- {
- type: selectedQuestion,
- details: questionText
- }
-
+ const questionBody: DelegateQuestionPayload | null =
+ selectedQuestion === "" ? null :
+ {
+ type: selectedQuestion,
+ details: questionText
+ }
+
const resetMotionFields = () => {
@@ -130,7 +132,16 @@ export default function TestButton() {
}
return (
-
+ {
+ if (!open) return
+
+ setMotionKind("moção")
+ resetMotionFields()
+ setQuestionText("")
+ setAnswerText("")
+ }}
+ >
@@ -208,9 +219,9 @@ export default function TestButton() {
{
- if(motionKind === "moção") setSelectedMotion(value as Motions)
- else if(motionKind === "questão") setSelectedQuestion(value as Questions | "")
+ onValueChange={(value: Motions | Questions | "") => {
+ if (motionKind === "moção") setSelectedMotion(value as Motions)
+ else if (motionKind === "questão") setSelectedQuestion(value as Questions | "")
setDebateKind("")
setUnmoderatedMinutes("")
setSpeechCount("")
@@ -225,13 +236,13 @@ export default function TestButton() {
- {motionOptions.map((item) =>
- {
- if(item !== "") return (
-
- {item}
-
- )})}
+ {motionOptions.map((item) => {
+ if (item !== "") return (
+
+ {item}
+
+ )
+ })}
@@ -307,19 +318,25 @@ export default function TestButton() {
{showMotionDecision && isChair && (
-
- Acatar moção
-
-
- Rejeitar moção
-
+
+
+ Acatar moção
+
+
+
+
+ Rejeitar moção
+
+
)}
{showMotionDecision && !isChair && (
- {sendMessage({type:DelegateEvents.SUBMIT_MOTION_EVENT, payload: motionBody} satisfies SubmitMotionEvent)}} className="flex-1 bg-green-800 text-white hover:bg-green-700" type="button">
- Enviar moção
-
+
+ { sendMessage({ type: DelegateEvents.SUBMIT_MOTION_EVENT, payload: motionBody } satisfies SubmitMotionEvent) }} className="flex-1 bg-green-800 text-white hover:bg-green-700" type="button">
+ Enviar moção
+
+
)}
@@ -333,15 +350,15 @@ export default function TestButton() {
onChange={(event) => setQuestionText(event.target.value)}
/>
- { isChair && (
-
- Digite a resposta
- setAnswerText(event.target.value)}
- />
- )
+ {isChair && (
+
+ Digite a resposta
+ setAnswerText(event.target.value)}
+ />
+ )
}
{if(questionBody)sendMessage({type:DelegateEvents.SUBMIT_QUESTION_EVENT, payload: questionBody} satisfies SubmitQuestionEvent)}} className="w-full bg-green-800 text-white hover:bg-green-700" type="button">
Registrar questão{isChair && " e resposta"}
From 9439c61375df1cbefc24743bff2b7674525d8824 Mon Sep 17 00:00:00 2001
From: Le-frances13 <100540487+Le-frances13@users.noreply.github.com>
Date: Mon, 24 Aug 2026 09:14:36 -0300
Subject: [PATCH 04/39] feat: voting results
---
.../src/components/session/Sidebar/voting.tsx | 35 ++--
.../session/voting-results-popup.tsx | 149 ++++++++++++++++++
frontend/src/pages/Session.tsx | 2 +
3 files changed, 176 insertions(+), 10 deletions(-)
create mode 100644 frontend/src/components/session/voting-results-popup.tsx
diff --git a/frontend/src/components/session/Sidebar/voting.tsx b/frontend/src/components/session/Sidebar/voting.tsx
index f0ba5ce..4d54b32 100644
--- a/frontend/src/components/session/Sidebar/voting.tsx
+++ b/frontend/src/components/session/Sidebar/voting.tsx
@@ -2,17 +2,17 @@ import { Button } from "@/components/ui/button"
import { Separator } from "@/components/ui/separator"
import { useCommitteeStore } from "@/store/useCommitteeStore"
-import {Badge} from "@/components/ui/badge"
+import { Badge } from "@/components/ui/badge"
import { useSession } from "@/context/SessionContext"
-import { SessionRoles, RollCallChoice, VotingChoice, MajorityTypes} from "@/schemas/types.gen"
+import { SessionRoles, RollCallChoice, VotingChoice, MajorityTypes } from "@/schemas/types.gen"
-//TODO determine if queue is open, if not obscure the button and show a message that the queue is closed
+//TODO implement rules of procedure to determine if abstentions count towards the majority or not. For now, we will assume they do not count towards the majority.
export default function VotingMenu() {
const voteTitle = useCommitteeStore((state) => state.voting?.motion_in_vote?.type ?? "ERROR:VotingTitle not found")
-
+
const expectedVotes = useCommitteeStore((state) => Object.entries(state.roll_call?.registry ?? {}).filter(([, choice]) => choice !== RollCallChoice.ABSENT).length)
const yayVotes = useCommitteeStore((state) => Object.entries(state.voting?.voting_registry ?? {}).filter(([, choice]) => choice === VotingChoice.FAVOUR).length)
@@ -25,10 +25,17 @@ export default function VotingMenu() {
? expectedVotes
: Math.floor(expectedVotes / 2) + 1
+ const canBeVetoed = useCommitteeStore((state) => state.voting?.allow_veto_power ?? false)
+ const whoCanVeto = useCommitteeStore((state) => Object.values(state.delegations)
+ .filter((delegation) => ["fr", "us", "cn", "ru", "uk"].includes(delegation.code.toLowerCase()))
+ .map((delegation) => delegation.id))
+ const isVetoed = useCommitteeStore((state) => Object.entries(state.voting?.voting_registry ?? {})
+ .some(([id, choice]) => choice === VotingChoice.AGAINST
+ && whoCanVeto.some((vetoId) => String(vetoId) === id)))
+
+ const { role } = useSession()
+ const isChair = role === SessionRoles.CHAIR
- const {role} = useSession()
- const isChair = role===SessionRoles.CHAIR
-
const votedCount = yayVotes + nayVotes + abstentions
const pendingVotes = expectedVotes - votedCount
const majorityPosition = expectedVotes
@@ -45,7 +52,7 @@ export default function VotingMenu() {
Resultados parciais:
Votaram {votedCount} de {expectedVotes} delegações
-
+
-
+
Sim: {yayVotes}
@@ -87,8 +94,16 @@ export default function VotingMenu() {
Não: {nayVotes}
Maioria Necessaria: {requiredMajority} votos
-
+
+ {canBeVetoed && isVetoed && (
+
A moção foi vetada.
+ )}
+ {!canBeVetoed || !isVetoed ? yayVotes >= requiredMajority ? (
+
A moção passa!
+ ) : (
+
A moção nao passsa.
+ ) : null}
{isChair && (
diff --git a/frontend/src/components/session/voting-results-popup.tsx b/frontend/src/components/session/voting-results-popup.tsx
new file mode 100644
index 0000000..c128b1f
--- /dev/null
+++ b/frontend/src/components/session/voting-results-popup.tsx
@@ -0,0 +1,149 @@
+import {
+ Dialog,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+ DialogClose,
+} from "@/components/ui/dialog"
+
+import { useCommitteeStore } from "@/store/useCommitteeStore"
+import { useSession } from "@/context/SessionContext"
+import { MajorityTypes, SessionRoles, VotingChoice, RollCallChoice } from "@/schemas/types.gen"
+import { Button } from "@/components/ui/button"
+
+
+
+export default function VotingResultsPopup() {
+
+ const { role, representation_id } = useSession()
+ const isChair = role == SessionRoles.CHAIR
+
+
+
+ const voting = useCommitteeStore((state) => state.voting ?? null)
+ const voteTitle = voting?.title ?? voting?.motion_in_vote?.type ?? "ERROR:VotingTitle not found"
+
+ const expectedVotes = useCommitteeStore((state) => Object.entries(state.roll_call?.registry ?? {}).filter(([, choice]) => choice !== RollCallChoice.ABSENT).length)
+ const yayVotes = useCommitteeStore((state) => Object.entries(state.voting?.voting_registry ?? {}).filter(([, choice]) => choice === VotingChoice.FAVOUR).length)
+ const nayVotes = useCommitteeStore((state) => Object.entries(state.voting?.voting_registry ?? {}).filter(([, choice]) => choice === VotingChoice.AGAINST).length)
+ const abstentions = expectedVotes - yayVotes - nayVotes
+ const yayPercentage = expectedVotes > 0 ? (yayVotes / expectedVotes) * 100 : 0
+ const nayPercentage = expectedVotes > 0 ? (nayVotes / expectedVotes) * 100 : 0
+ const majorityType = useCommitteeStore((state) => state.voting?.majority ?? MajorityTypes.MAIORIA_SIMPLES)
+ const requiredMajority = majorityType === MajorityTypes.MAIORIA_QUALIFICADA
+ ? Math.ceil(expectedVotes * 2 / 3)
+ : majorityType === MajorityTypes.CONSENSO
+ ? expectedVotes
+ : Math.floor(expectedVotes / 2) + 1
+ const requiredMajorityPercentage = expectedVotes > 0 ? (requiredMajority / expectedVotes) * 100 : 0
+ const requiredMajorityAngle = Math.PI * requiredMajorityPercentage / 100
+ const markerInnerRadius = 67
+ const markerOuterRadius = 94
+ const markerStartX = 100 - markerInnerRadius * Math.cos(requiredMajorityAngle)
+ const markerStartY = 100 - markerInnerRadius * Math.sin(requiredMajorityAngle)
+ const markerEndX = 100 - markerOuterRadius * Math.cos(requiredMajorityAngle)
+ const markerEndY = 100 - markerOuterRadius * Math.sin(requiredMajorityAngle)
+
+
+ const canBeVetoed = useCommitteeStore((state) => state.voting?.allow_veto_power ?? false)
+ const whoCanVeto = useCommitteeStore((state) => Object.values(state.delegations)
+ .filter((delegation) => ["fr", "us", "cn", "ru", "uk"].includes(delegation.code.toLowerCase()))
+ .map((delegation) => delegation.id))
+ const isVetoed = useCommitteeStore((state) => Object.entries(state.voting?.voting_registry ?? {})
+ .some(([id, choice]) => choice === VotingChoice.AGAINST
+ && whoCanVeto.some((vetoId) => String(vetoId) === id)))
+
+
+
+ return (
+
+
+
+ Resultados da Votação
+ {voteTitle}
+
+
+
+
+
+
+
+
+ {`Maioria necessária: ${requiredMajority} de ${expectedVotes}`}
+
+
+ {yayVotes}/{expectedVotes} a favor
+
+
+
+
+
+
+ A favor: {yayVotes}
+
+
+
+ Contra: {nayVotes}
+
+
+
+ Abstenções: {Math.max(abstentions, 0)}
+
+
+ {canBeVetoed && isVetoed && (
+
A moção foi vetada.
+ )}
+ {!canBeVetoed || !isVetoed ? yayVotes >= requiredMajority ? (
+
A moção passa!
+ ) : (
+
A moção nao passsa.
+ ) : null}
+
+
+
+
+
+
+ Fechar
+
+
+
+
+ )
+}
\ No newline at end of file
diff --git a/frontend/src/pages/Session.tsx b/frontend/src/pages/Session.tsx
index c670817..fe5483a 100644
--- a/frontend/src/pages/Session.tsx
+++ b/frontend/src/pages/Session.tsx
@@ -11,6 +11,7 @@ import BottomBar from "@/components/session/bottom-bar"
import TopBar from '@/components/session/top-bar';
import DelegationMap from '@/components/session/delegation-map';
import VotingPopup from '@/components/session/voting-popup.tsx';
+import VotingResultsPopup from '@/components/session/voting-results-popup.tsx';
import { Spinner } from "@/components/ui/spinner"
import { States } from '@/schemas/types.gen';
import { Clock8 } from 'lucide-react';
@@ -48,6 +49,7 @@ export default function SessionPage() {
*/}
+
From 9158e00502106240b1e966627017f19b4bde0caf Mon Sep 17 00:00:00 2001
From: Le-frances13 <100540487+Le-frances13@users.noreply.github.com>
Date: Mon, 24 Aug 2026 09:24:49 -0300
Subject: [PATCH 05/39] fix: veto check stops crashing frontend
---
.../src/components/session/Sidebar/voting.tsx | 20 +++++++++-----
.../session/voting-results-popup.tsx | 26 ++++++++++---------
2 files changed, 27 insertions(+), 19 deletions(-)
diff --git a/frontend/src/components/session/Sidebar/voting.tsx b/frontend/src/components/session/Sidebar/voting.tsx
index 4d54b32..f8dec62 100644
--- a/frontend/src/components/session/Sidebar/voting.tsx
+++ b/frontend/src/components/session/Sidebar/voting.tsx
@@ -26,13 +26,19 @@ export default function VotingMenu() {
: Math.floor(expectedVotes / 2) + 1
const canBeVetoed = useCommitteeStore((state) => state.voting?.allow_veto_power ?? false)
- const whoCanVeto = useCommitteeStore((state) => Object.values(state.delegations)
- .filter((delegation) => ["fr", "us", "cn", "ru", "uk"].includes(delegation.code.toLowerCase()))
- .map((delegation) => delegation.id))
- const isVetoed = useCommitteeStore((state) => Object.entries(state.voting?.voting_registry ?? {})
- .some(([id, choice]) => choice === VotingChoice.AGAINST
- && whoCanVeto.some((vetoId) => String(vetoId) === id)))
-
+ const delegations = useCommitteeStore((state) => state.delegations)
+ const whoCanVeto = Object.values(delegations)
+ .filter((delegation) => ["fr", "us", "cn", "ru", "uk"].includes(delegation.code?.toLowerCase() ?? ""))
+ .map((delegation) => delegation.id)
+ const isVetoed = useCommitteeStore((state) => {
+ const votingRegistry = state.voting?.voting_registry
+ if (!votingRegistry) return false
+
+ return Object.entries(votingRegistry)
+ .some(([id, choice]) => choice === VotingChoice.AGAINST
+ && whoCanVeto.some((vetoId) => String(vetoId) === id))
+ })
+
const { role } = useSession()
const isChair = role === SessionRoles.CHAIR
diff --git a/frontend/src/components/session/voting-results-popup.tsx b/frontend/src/components/session/voting-results-popup.tsx
index c128b1f..975afd6 100644
--- a/frontend/src/components/session/voting-results-popup.tsx
+++ b/frontend/src/components/session/voting-results-popup.tsx
@@ -9,17 +9,13 @@ import {
} from "@/components/ui/dialog"
import { useCommitteeStore } from "@/store/useCommitteeStore"
-import { useSession } from "@/context/SessionContext"
-import { MajorityTypes, SessionRoles, VotingChoice, RollCallChoice } from "@/schemas/types.gen"
+import { MajorityTypes, VotingChoice, RollCallChoice } from "@/schemas/types.gen"
import { Button } from "@/components/ui/button"
export default function VotingResultsPopup() {
- const { role, representation_id } = useSession()
- const isChair = role == SessionRoles.CHAIR
-
const voting = useCommitteeStore((state) => state.voting ?? null)
@@ -48,17 +44,23 @@ export default function VotingResultsPopup() {
const canBeVetoed = useCommitteeStore((state) => state.voting?.allow_veto_power ?? false)
- const whoCanVeto = useCommitteeStore((state) => Object.values(state.delegations)
- .filter((delegation) => ["fr", "us", "cn", "ru", "uk"].includes(delegation.code.toLowerCase()))
- .map((delegation) => delegation.id))
- const isVetoed = useCommitteeStore((state) => Object.entries(state.voting?.voting_registry ?? {})
- .some(([id, choice]) => choice === VotingChoice.AGAINST
- && whoCanVeto.some((vetoId) => String(vetoId) === id)))
+ const delegations = useCommitteeStore((state) => state.delegations)
+ const whoCanVeto = Object.values(delegations)
+ .filter((delegation) => ["fr", "us", "cn", "ru", "uk"].includes(delegation.code?.toLowerCase() ?? ""))
+ .map((delegation) => delegation.id)
+ const isVetoed = useCommitteeStore((state) => {
+ const votingRegistry = state.voting?.voting_registry
+ if (!votingRegistry) return false
+
+ return Object.entries(votingRegistry)
+ .some(([id, choice]) => choice === VotingChoice.AGAINST
+ && whoCanVeto.some((vetoId) => String(vetoId) === id))
+ })
return (
-
+
Resultados da Votação
From 5015af3ecdfe65cd4f4889b269c4fbf412db991c Mon Sep 17 00:00:00 2001
From: Extroias <91105220+Extroias@users.noreply.github.com>
Date: Tue, 25 Aug 2026 22:54:08 -0300
Subject: [PATCH 06/39] fix: minor fixes
---
backend/app/session/engine.py | 2 +
.../src/components/session/Sidebar/voting.tsx | 37 ++++++++++---------
.../session/voting-results-popup.tsx | 5 ++-
3 files changed, 24 insertions(+), 20 deletions(-)
diff --git a/backend/app/session/engine.py b/backend/app/session/engine.py
index 093cbe4..7816ad3 100644
--- a/backend/app/session/engine.py
+++ b/backend/app/session/engine.py
@@ -595,6 +595,8 @@ def apply_passed_motion(
reset_timer(state, state.gsl_default_time_seconds)
match motion.type:
+ case Motions.CHANGE_DEBATE_TYPE:
+ pass
case Motions.POSTPONE_SESSION:
pass
case Motions.REOPEN_SESSION:
diff --git a/frontend/src/components/session/Sidebar/voting.tsx b/frontend/src/components/session/Sidebar/voting.tsx
index f8dec62..470cf4b 100644
--- a/frontend/src/components/session/Sidebar/voting.tsx
+++ b/frontend/src/components/session/Sidebar/voting.tsx
@@ -4,41 +4,36 @@ import { Separator } from "@/components/ui/separator"
import { useCommitteeStore } from "@/store/useCommitteeStore"
import { Badge } from "@/components/ui/badge"
-import { useSession } from "@/context/SessionContext"
-import { SessionRoles, RollCallChoice, VotingChoice, MajorityTypes } from "@/schemas/types.gen"
+import { sendMessage, useSession } from "@/context/SessionContext"
+import { SessionRoles, RollCallChoice, VotingChoice, MajorityTypes, type CloseInformalVotingEvent, VotingType, type CloseProceduralVotingEvent, ChairEvents } from "@/schemas/types.gen"
//TODO implement rules of procedure to determine if abstentions count towards the majority or not. For now, we will assume they do not count towards the majority.
export default function VotingMenu() {
- const voteTitle = useCommitteeStore((state) => state.voting?.motion_in_vote?.type ?? "ERROR:VotingTitle not found")
-
+ const voteTitle = useCommitteeStore((state) => state.voting?.title ?? state.voting?.motion_in_vote?.type ?? "ERROR:VotingTitle not found")
+ const voting = useCommitteeStore((state) => state.voting ?? null)
const expectedVotes = useCommitteeStore((state) => Object.entries(state.roll_call?.registry ?? {}).filter(([, choice]) => choice !== RollCallChoice.ABSENT).length)
- const yayVotes = useCommitteeStore((state) => Object.entries(state.voting?.voting_registry ?? {}).filter(([, choice]) => choice === VotingChoice.FAVOUR).length)
- const nayVotes = useCommitteeStore((state) => Object.entries(state.voting?.voting_registry ?? {}).filter(([, choice]) => choice === VotingChoice.AGAINST).length)
- const abstentions = useCommitteeStore((state) => Object.entries(state.voting?.voting_registry ?? {}).filter(([, choice]) => choice === VotingChoice.ABSTAIN).length)
- const majorityType = useCommitteeStore((state) => state.voting?.majority ?? MajorityTypes.MAIORIA_SIMPLES)
+ const yayVotes = Object.entries(voting?.voting_registry ?? {}).filter(([, choice]) => choice === VotingChoice.FAVOUR).length
+ const nayVotes = Object.entries(voting?.voting_registry ?? {}).filter(([, choice]) => choice === VotingChoice.AGAINST).length
+ const abstentions = Object.entries(voting?.voting_registry ?? {}).filter(([, choice]) => choice === VotingChoice.ABSTAIN).length
+ const majorityType = voting?.majority ?? MajorityTypes.MAIORIA_SIMPLES
const requiredMajority = majorityType === MajorityTypes.MAIORIA_QUALIFICADA
? Math.ceil(expectedVotes * 2 / 3)
: majorityType === MajorityTypes.CONSENSO
? expectedVotes
: Math.floor(expectedVotes / 2) + 1
- const canBeVetoed = useCommitteeStore((state) => state.voting?.allow_veto_power ?? false)
+ const canBeVetoed = voting?.allow_veto_power ?? false
const delegations = useCommitteeStore((state) => state.delegations)
const whoCanVeto = Object.values(delegations)
.filter((delegation) => ["fr", "us", "cn", "ru", "uk"].includes(delegation.code?.toLowerCase() ?? ""))
.map((delegation) => delegation.id)
- const isVetoed = useCommitteeStore((state) => {
- const votingRegistry = state.voting?.voting_registry
- if (!votingRegistry) return false
-
- return Object.entries(votingRegistry)
+ const isVetoed = voting?.voting_registry ? Object.entries(voting?.voting_registry)
.some(([id, choice]) => choice === VotingChoice.AGAINST
- && whoCanVeto.some((vetoId) => String(vetoId) === id))
- })
-
+ && whoCanVeto.some((vetoId) => String(vetoId) === id)) : false
+
const { role } = useSession()
const isChair = role === SessionRoles.CHAIR
@@ -112,7 +107,13 @@ export default function VotingMenu() {
) : null}
{isChair && (
-
+ {
+ if(voting?.target_type === VotingType.INFORMAL)
+ sendMessage({type: ChairEvents.CLOSE_INFORMAL_VOTING_EVENT, payload:{}} satisfies CloseInformalVotingEvent)
+ else if(voting?.target_type === VotingType.PROCEDURAL)
+ sendMessage({type: ChairEvents.CLOSE_PROCEDURAL_VOTING_EVENT, payload: {}} satisfies CloseProceduralVotingEvent)
+ }}>
Encerrar votação
diff --git a/frontend/src/components/session/voting-results-popup.tsx b/frontend/src/components/session/voting-results-popup.tsx
index 975afd6..88b839b 100644
--- a/frontend/src/components/session/voting-results-popup.tsx
+++ b/frontend/src/components/session/voting-results-popup.tsx
@@ -11,6 +11,7 @@ import {
import { useCommitteeStore } from "@/store/useCommitteeStore"
import { MajorityTypes, VotingChoice, RollCallChoice } from "@/schemas/types.gen"
import { Button } from "@/components/ui/button"
+import { useState } from "react"
@@ -42,7 +43,6 @@ export default function VotingResultsPopup() {
const markerEndX = 100 - markerOuterRadius * Math.cos(requiredMajorityAngle)
const markerEndY = 100 - markerOuterRadius * Math.sin(requiredMajorityAngle)
-
const canBeVetoed = useCommitteeStore((state) => state.voting?.allow_veto_power ?? false)
const delegations = useCommitteeStore((state) => state.delegations)
const whoCanVeto = Object.values(delegations)
@@ -57,10 +57,11 @@ export default function VotingResultsPopup() {
&& whoCanVeto.some((vetoId) => String(vetoId) === id))
})
+ const [open, setOpen] = useState(true)
return (
-
+
Resultados da Votação
From c743f91053d001b2f6f669668ce53856fe013a07 Mon Sep 17 00:00:00 2001
From: Le-frances13 <100540487+Le-frances13@users.noreply.github.com>
Date: Sat, 29 Aug 2026 14:37:26 -0300
Subject: [PATCH 07/39] feat: many UI fixes
---
.../session/Sidebar/moderated-debate.tsx | 83 ++++++++++++-------
.../session/Sidebar/speaker-list.tsx | 60 ++++++++------
.../session/Sidebar/unmoderated-debate.tsx | 12 ++-
frontend/src/pages/Session.tsx | 5 +-
4 files changed, 100 insertions(+), 60 deletions(-)
diff --git a/frontend/src/components/session/Sidebar/moderated-debate.tsx b/frontend/src/components/session/Sidebar/moderated-debate.tsx
index eeefb8e..808774d 100644
--- a/frontend/src/components/session/Sidebar/moderated-debate.tsx
+++ b/frontend/src/components/session/Sidebar/moderated-debate.tsx
@@ -21,8 +21,9 @@ import { SessionRoles } from "@/schemas/types.gen"
export default function ModeratedDebate() {
- const {role} = useSession()
- const isChair = role===SessionRoles.CHAIR
+ const { role } = useSession()
+ const remainingDiscouses = 1
+ const isChair = role === SessionRoles.CHAIR
const gslQueue = useCommitteeStore((state) => state.gsl_queue ?? [])
const currentSpeaker = useCommitteeStore((state) => state.current_speaker)
const delegationsById = useCommitteeStore((state) => state.delegations)
@@ -32,7 +33,7 @@ export default function ModeratedDebate() {
})
const waitingCount = queuedDelegations.length
-//TODO: Actually implement speaker history
+ //TODO: Actually implement speaker history
return (
@@ -80,34 +81,54 @@ export default function ModeratedDebate() {
)}
{isChair && (
-
-
-
-
- Proximo
- Proximo Orador
-
-
-
- Escolher o próximo orador
-
-
-
-
-
- Cessao
- Cessao de Tempo
-
-
-
- Ceder tempo restante a outra delegacao
-
-
-
+
+
+
+
+
+ Proximo
+ Proximo Orador
+
+
+
+ Escolher o próximo orador
+
+
+
+
+
+ Cessao
+ Cessao de Tempo
+
+
+
+ Ceder tempo restante a outra delegacao
+
+
+
+
+
+
+
+ Encerrar Fala
+
+
+
+ Finalizar a fala atual e ceder o tempo a mesa
+
+
+
+ {remainingDiscouses > 0 && (
+
+ {remainingDiscouses} discursos restantes
+
+ )}
+
+
)}
diff --git a/frontend/src/components/session/Sidebar/speaker-list.tsx b/frontend/src/components/session/Sidebar/speaker-list.tsx
index a740831..d3a091b 100644
--- a/frontend/src/components/session/Sidebar/speaker-list.tsx
+++ b/frontend/src/components/session/Sidebar/speaker-list.tsx
@@ -24,8 +24,8 @@ import { SessionRoles } from "@/schemas/types.gen"
export default function SpeakerList() {
- const {role, representation_id} = useSession()
- const isChair = role===SessionRoles.CHAIR
+ const { role, representation_id } = useSession()
+ const isChair = role === SessionRoles.CHAIR
const gslQueue = useCommitteeStore((state) => state.gsl_queue ?? [])
const currentSpeaker = useCommitteeStore((state) => state.current_speaker)
const delegationsById = useCommitteeStore((state) => state.delegations)
@@ -81,38 +81,50 @@ export default function SpeakerList() {
variant="outline"
className="mr-4 mb-2 ml-4 w-auto min-w-0 overflow-hidden text-ellipsis whitespace-nowrap"
disabled={alreadyInQueue}
- onClick={()=>sendMessage({type:DelegateEvents.JOIN_QUEUE_EVENT, payload:{}} satisfies JoinQueueEvent)}
+ onClick={() => sendMessage({ type: DelegateEvents.JOIN_QUEUE_EVENT, payload: {} } satisfies JoinQueueEvent)}
>
Se colocar na lista de oradores
)}
{isChair && (
-
-
-
- sendMessage({ type: ChairEvents.NEXT_SPEAKER_EVENT, payload: {} } satisfies NextSpeakerEvent)}
- >
- Proximo
- Proximo Orador
-
-
-
- Passar para o próximo orador da lista
-
-
+
+
+
+
+ sendMessage({ type: ChairEvents.NEXT_SPEAKER_EVENT, payload: {} } satisfies NextSpeakerEvent)}
+ >
+ Proximo
+ Proximo Orador
+
+
+
+ Passar para o próximo orador da lista
+
+
+
+
+
+ Cessao
+ Cessao de Tempo
+
+
+
+ Ceder tempo restante a outra delegacao
+
+
+
-
- Cessao
- Cessao de Tempo
+
+ Encerrar Fala
- Ceder tempo restante a outra delegacao
+ Finalizar a fala atual e ceder o tempo a mesa
diff --git a/frontend/src/components/session/Sidebar/unmoderated-debate.tsx b/frontend/src/components/session/Sidebar/unmoderated-debate.tsx
index 759ab27..ee3870b 100644
--- a/frontend/src/components/session/Sidebar/unmoderated-debate.tsx
+++ b/frontend/src/components/session/Sidebar/unmoderated-debate.tsx
@@ -1,6 +1,8 @@
import { Button } from "@/components/ui/button"
import { Separator } from "@/components/ui/separator"
-import { Play, Pause } from "lucide-react"
+import { Play, Pause, Plus } from "lucide-react"
+import { sendMessage } from "@/context/SessionContext"
+import { type IncreaseTimerEvent, ChairEvents } from "@/schemas/types.gen"
import { useState } from "react"
@@ -18,7 +20,8 @@ export default function UnmoderatedDebate() {
08:00
-
+
{isRunning ? : }
- Temporizador placeholder
+ sendMessage({ type: ChairEvents.INCREASE_TIMER_EVENT, payload: { seconds: 5 } } satisfies IncreaseTimerEvent)}> 5s
+
+
+
diff --git a/frontend/src/pages/Session.tsx b/frontend/src/pages/Session.tsx
index fe5483a..e0dd982 100644
--- a/frontend/src/pages/Session.tsx
+++ b/frontend/src/pages/Session.tsx
@@ -59,11 +59,12 @@ export default function SessionPage() {
/>
- {currentState === States.SETUP_ROOM &&
}
+ {/*currentState === States.SETUP_ROOM &&
}
{currentState === States.OPEN_GSL &&
}
{currentState === States.MODERATED_CAUCUS &&
}
{currentState === States.UNMODERATED_CAUCUS &&
}
- {currentState === States.VOTING_EXECUTION &&
}
+ {currentState === States.VOTING_EXECUTION &&
*/}
+
{currentState !== States.SETUP_ROOM &&
}
From ca51636042a3b5fb80d0088d54fefb606f437e89 Mon Sep 17 00:00:00 2001
From: Le-frances13 <100540487+Le-frances13@users.noreply.github.com>
Date: Sat, 29 Aug 2026 14:59:36 -0300
Subject: [PATCH 08/39] Fix: motions button locked in unmoderated debate
---
.../components/session/bottom-bar-buttons/MotionsButton.tsx | 2 +-
frontend/src/components/session/bottom-bar.tsx | 2 +-
frontend/src/pages/Session.tsx | 5 ++---
3 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/frontend/src/components/session/bottom-bar-buttons/MotionsButton.tsx b/frontend/src/components/session/bottom-bar-buttons/MotionsButton.tsx
index 68ef1c7..8be3020 100644
--- a/frontend/src/components/session/bottom-bar-buttons/MotionsButton.tsx
+++ b/frontend/src/components/session/bottom-bar-buttons/MotionsButton.tsx
@@ -143,7 +143,7 @@ export default function TestButton() {
}}
>
-
+
diff --git a/frontend/src/components/session/bottom-bar.tsx b/frontend/src/components/session/bottom-bar.tsx
index ce5503c..d81f041 100644
--- a/frontend/src/components/session/bottom-bar.tsx
+++ b/frontend/src/components/session/bottom-bar.tsx
@@ -7,7 +7,7 @@ import ExitButton from "./bottom-bar-buttons/ExitButton"
import BRBButton from "./bottom-bar-buttons/BRB"
import IncidentHelp from "./bottom-bar-buttons/IncidentHelp"
import { useSession } from "@/context/SessionContext"
-import { SessionRoles } from "@/schemas/types.gen"
+import { SessionRoles} from "@/schemas/types.gen"
export default function BottomBar() {
diff --git a/frontend/src/pages/Session.tsx b/frontend/src/pages/Session.tsx
index e0dd982..fe5483a 100644
--- a/frontend/src/pages/Session.tsx
+++ b/frontend/src/pages/Session.tsx
@@ -59,12 +59,11 @@ export default function SessionPage() {
/>
- {/*currentState === States.SETUP_ROOM &&
}
+ {currentState === States.SETUP_ROOM &&
}
{currentState === States.OPEN_GSL &&
}
{currentState === States.MODERATED_CAUCUS &&
}
{currentState === States.UNMODERATED_CAUCUS &&
}
- {currentState === States.VOTING_EXECUTION &&
*/}
-
+ {currentState === States.VOTING_EXECUTION &&
}
{currentState !== States.SETUP_ROOM &&
}
From 779508bd2fb31ef29975e529a64cee13c564e025 Mon Sep 17 00:00:00 2001
From: Extroias <91105220+Extroias@users.noreply.github.com>
Date: Sat, 29 Aug 2026 15:03:46 -0300
Subject: [PATCH 09/39] fix: improve apply passed motion and allowed motions
list
---
backend/app/session/engine.py | 116 +++++++++++++++++-----------------
1 file changed, 57 insertions(+), 59 deletions(-)
diff --git a/backend/app/session/engine.py b/backend/app/session/engine.py
index 7816ad3..b610be7 100644
--- a/backend/app/session/engine.py
+++ b/backend/app/session/engine.py
@@ -50,34 +50,37 @@ def __init__(self, code: enums.EventErrorCode, message: str) -> None:
Motions.POSTPONE_SESSION,
Motions.TOUR_DE_TABLE,
Motions.END_DEBATE,
- Motions.VOTE_AMENDMENT,
- Motions.VOTE_BY_ROLL_CALL,
Motions.CLOSE_SPEAKERS_LIST,
- Motions.SPLIT_PROPOSAL,
Motions.INTRODUCE_RESOLUTION_PROPOSAL,
- Motions.INTRODUCE_AMENDMENT_PROPOSAL,
Motions.CHANGE_TOPIC,
Motions.QUORUM,
Motions.CUSTOM_MOTION,
},
States.CLOSED_GSL: {
- Motions.REOPEN_SPEAKERS_LIST,
+ Motions.CHANGE_DEBATE_TYPE,
+ Motions.POSTPONE_SESSION,
+ Motions.TOUR_DE_TABLE,
Motions.END_DEBATE,
- Motions.VOTE_AMENDMENT,
- Motions.VOTE_BY_ROLL_CALL,
+ Motions.REOPEN_SPEAKERS_LIST,
Motions.INTRODUCE_RESOLUTION_PROPOSAL,
- Motions.INTRODUCE_AMENDMENT_PROPOSAL,
+ Motions.CHANGE_TOPIC,
Motions.QUORUM,
Motions.CUSTOM_MOTION,
},
States.VOTING_PREPARATION: {
Motions.VOTE_BY_ROLL_CALL,
Motions.SPLIT_PROPOSAL,
+ Motions.INTRODUCE_AMENDMENT_PROPOSAL,
+ Motions.VOTE_AMENDMENT,
Motions.CUSTOM_MOTION,
},
States.MODERATED_CAUCUS: {
+ Motions.CHANGE_DEBATE_TYPE,
Motions.POSTPONE_SESSION,
+ Motions.TOUR_DE_TABLE,
Motions.END_DEBATE,
+ Motions.INTRODUCE_RESOLUTION_PROPOSAL,
+ Motions.CHANGE_TOPIC,
Motions.QUORUM,
Motions.CUSTOM_MOTION,
},
@@ -278,7 +281,7 @@ def handle_delegate_submit_motion(
)
if (
- current_state in {States.MODERATED_CAUCUS, States.UNMODERATED_CAUCUS}
+ current_state in {States.UNMODERATED_CAUCUS}
and not state.can_set_motion
):
raise EventRejectedError(
@@ -551,52 +554,52 @@ def apply_passed_motion(
state.timer_is_running = False
state.timer_expiration = None
- # 1st block: change of debate motions
- if motion.type == Motions.CHANGE_DEBATE_TYPE and motion.debate_type is not None:
- state.caucus_list = []
- state.current_speaker = None
- duration_seconds = (
- (motion.total_duration_minutes * 60)
- if motion.total_duration_minutes is not None
- else 600
- ) # defaults to 10 minutes as fallback
-
- match motion.debate_type:
- case DebateTypes.MODERATED_DEBATE:
- next_state = States.MODERATED_CAUCUS
- state.debate = DebateContext(
- debate_type=DebateTypes.MODERATED_DEBATE,
- return_state=return_state,
- total_duration_seconds=duration_seconds,
- per_speaker_seconds=motion.per_speaker_seconds,
- expires_at=datetime.now(UTC) + timedelta(seconds=duration_seconds),
- )
- reset_timer(
- state,
- motion.per_speaker_seconds
- if motion.per_speaker_seconds is not None
- else 60,
- )
-
- case DebateTypes.UNMODERATED_DEBATE:
- next_state = States.UNMODERATED_CAUCUS
- state.debate = DebateContext(
- debate_type=DebateTypes.UNMODERATED_DEBATE,
- return_state=return_state,
- total_duration_seconds=duration_seconds,
- per_speaker_seconds=None,
- expires_at=datetime.now(UTC) + timedelta(seconds=duration_seconds),
- )
- reset_timer(state) # should not display per_speaker timer
-
- case DebateTypes.SPEAKERS_LIST:
- next_state = States.OPEN_GSL
- state.debate = None
- reset_timer(state, state.gsl_default_time_seconds)
-
- match motion.type:
+ match motion.type:
case Motions.CHANGE_DEBATE_TYPE:
- pass
+ if motion.debate_type is None:
+ raise EventRejectedError(
+ code=enums.EventErrorCode.INVALID_MESSAGE,
+ message="No Debate Type Provided",
+ )
+ state.current_speaker = None
+ duration_seconds = (
+ (motion.total_duration_minutes * 60)
+ if motion.total_duration_minutes is not None
+ else 600
+ ) # defaults to 10 minutes as fallback
+
+ match motion.debate_type:
+ case DebateTypes.MODERATED_DEBATE:
+ next_state = States.MODERATED_CAUCUS
+ state.debate = DebateContext(
+ debate_type=DebateTypes.MODERATED_DEBATE,
+ return_state=return_state,
+ total_duration_seconds=duration_seconds,
+ per_speaker_seconds=motion.per_speaker_seconds,
+ expires_at=datetime.now(UTC) + timedelta(seconds=duration_seconds),
+ )
+ reset_timer(
+ state,
+ motion.per_speaker_seconds
+ if motion.per_speaker_seconds is not None
+ else 60,
+ )
+
+ case DebateTypes.UNMODERATED_DEBATE:
+ next_state = States.UNMODERATED_CAUCUS
+ state.debate = DebateContext(
+ debate_type=DebateTypes.UNMODERATED_DEBATE,
+ return_state=return_state,
+ total_duration_seconds=duration_seconds,
+ per_speaker_seconds=None,
+ expires_at=datetime.now(UTC) + timedelta(seconds=duration_seconds),
+ )
+ reset_timer(state) # should not display per_speaker timer
+
+ case DebateTypes.SPEAKERS_LIST:
+ next_state = States.OPEN_GSL
+ state.debate = None
+ reset_timer(state, state.gsl_default_time_seconds)
case Motions.POSTPONE_SESSION:
pass
case Motions.REOPEN_SESSION:
@@ -982,11 +985,6 @@ def handle_mark_roll_call_bulk(
state: SessionLiveState, event: schemas.MarkRollCallBulkEvent, actor: SessionActor
) -> DispatchOutcome:
require_chair(actor)
- if state.current_state != States.ROLL_CALL or state.roll_call is None:
- raise EventRejectedError(
- code=enums.EventErrorCode.INVALID_STATE,
- message="Cannot mark roll call right now",
- )
for delegation_id in event.payload.Rollcalls.keys():
if delegation_id not in state.delegations:
From 09154d6e4ad8e6c47223f05abdedcef9a51e13e0 Mon Sep 17 00:00:00 2001
From: Extroias <91105220+Extroias@users.noreply.github.com>
Date: Sat, 29 Aug 2026 15:23:35 -0300
Subject: [PATCH 10/39] fix: changed error
---
backend/app/session/engine.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/backend/app/session/engine.py b/backend/app/session/engine.py
index b610be7..73b42da 100644
--- a/backend/app/session/engine.py
+++ b/backend/app/session/engine.py
@@ -115,12 +115,12 @@ def validate_motion_payload(
# can also raise error if there are missing fields
if (
payload.type == Motions.CHANGE_DEBATE_TYPE
- and payload.debate_type == DebateTypes.MODERATED_DEBATE
- and payload.per_speaker_seconds is None
+ and payload.debate_type == DebateTypes.UNMODERATED_DEBATE
+ and payload.total_duration_minutes is None
):
raise EventRejectedError(
code=enums.EventErrorCode.INVALID_MESSAGE,
- message="Cannot submit motion without speaking time",
+ message="Cannot submit motion this motion without duration",
)
From c8868e2abc9742c6b47449b9fcbf39a3a371e736 Mon Sep 17 00:00:00 2001
From: Le-frances13 <100540487+Le-frances13@users.noreply.github.com>
Date: Sat, 29 Aug 2026 15:42:51 -0300
Subject: [PATCH 11/39] feat: quorum sidebar menu
---
.../components/session/Sidebar/rollcall.tsx | 82 +++++++++++++++++++
frontend/src/pages/Session.tsx | 2 +
2 files changed, 84 insertions(+)
create mode 100644 frontend/src/components/session/Sidebar/rollcall.tsx
diff --git a/frontend/src/components/session/Sidebar/rollcall.tsx b/frontend/src/components/session/Sidebar/rollcall.tsx
new file mode 100644
index 0000000..ceaf75d
--- /dev/null
+++ b/frontend/src/components/session/Sidebar/rollcall.tsx
@@ -0,0 +1,82 @@
+import { useCommitteeStore } from "@/store/useCommitteeStore"
+import { RollCallChoice, SessionRoles } from "@/schemas/types.gen"
+import { Button } from "@/components/ui/button"
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
+} from "@/components/ui/tooltip"
+import { useSession } from "@/context/SessionContext"
+
+export default function RollCall() {
+ const presentDelegations = useCommitteeStore((state) => Object.entries(state.roll_call?.registry ?? {}).filter(([, choice]) => choice !== RollCallChoice.ABSENT).length)
+ const absentDelegations = useCommitteeStore((state) => Object.entries(state.roll_call?.registry ?? {}).filter(([, choice]) => choice === RollCallChoice.ABSENT).length)
+ const totalDelegations = useCommitteeStore((state) => Object.keys(state.delegations).length)
+
+ const { role } = useSession()
+ const isChair = role === SessionRoles.CHAIR
+
+ return (
+
+
+
Quorum
+
Responda o quorum
+
+
+
+
+
+
{presentDelegations} presentes e {absentDelegations} ausentes de {totalDelegations} delegacoes
+
+ {!isChair &&
+
+
+
+
+ Presente e votante
+
+
+
+ Você é considerado presente, e NÃO pode abster em votações substanciais.
+
+
+
+
+
+ Presente
+
+
+
+ Você é considerado presente, e pode abster em votações substanciais.
+
+
+
+ }
+
+
+
+ )
+}
\ No newline at end of file
diff --git a/frontend/src/pages/Session.tsx b/frontend/src/pages/Session.tsx
index fe5483a..6511751 100644
--- a/frontend/src/pages/Session.tsx
+++ b/frontend/src/pages/Session.tsx
@@ -12,6 +12,7 @@ import TopBar from '@/components/session/top-bar';
import DelegationMap from '@/components/session/delegation-map';
import VotingPopup from '@/components/session/voting-popup.tsx';
import VotingResultsPopup from '@/components/session/voting-results-popup.tsx';
+import RollCall from '@/components/session/Sidebar/rollcall.tsx';
import { Spinner } from "@/components/ui/spinner"
import { States } from '@/schemas/types.gen';
import { Clock8 } from 'lucide-react';
@@ -61,6 +62,7 @@ export default function SessionPage() {
{currentState === States.SETUP_ROOM &&
}
{currentState === States.OPEN_GSL &&
}
+ {currentState === States.ROLL_CALL &&
}
{currentState === States.MODERATED_CAUCUS &&
}
{currentState === States.UNMODERATED_CAUCUS &&
}
{currentState === States.VOTING_EXECUTION &&
}
From 8d4016b45720487b15ac87837dc7a63b2841509d Mon Sep 17 00:00:00 2001
From: Le-frances13 <100540487+Le-frances13@users.noreply.github.com>
Date: Sat, 29 Aug 2026 15:46:06 -0300
Subject: [PATCH 12/39] fix: voting menu sidebar text centering
---
frontend/src/components/session/Sidebar/voting.tsx | 2 ++
1 file changed, 2 insertions(+)
diff --git a/frontend/src/components/session/Sidebar/voting.tsx b/frontend/src/components/session/Sidebar/voting.tsx
index 470cf4b..9e2294a 100644
--- a/frontend/src/components/session/Sidebar/voting.tsx
+++ b/frontend/src/components/session/Sidebar/voting.tsx
@@ -97,6 +97,7 @@ export default function VotingMenu() {
Maioria Necessaria: {requiredMajority} votos
+
{canBeVetoed && isVetoed && (
A moção foi vetada.
)}
@@ -105,6 +106,7 @@ export default function VotingMenu() {
) : (
A moção nao passsa.
) : null}
+
{isChair && (
Date: Sat, 29 Aug 2026 15:52:43 -0300
Subject: [PATCH 13/39] fix: time cece button disables if there is no time to
cede
---
frontend/src/components/session/Sidebar/speaker-list.tsx | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/frontend/src/components/session/Sidebar/speaker-list.tsx b/frontend/src/components/session/Sidebar/speaker-list.tsx
index d3a091b..fc313a2 100644
--- a/frontend/src/components/session/Sidebar/speaker-list.tsx
+++ b/frontend/src/components/session/Sidebar/speaker-list.tsx
@@ -30,6 +30,7 @@ export default function SpeakerList() {
const currentSpeaker = useCommitteeStore((state) => state.current_speaker)
const delegationsById = useCommitteeStore((state) => state.delegations)
+ const timerRemaining = useCommitteeStore((state) => state.timer_remaining_seconds);
const alreadyInQueue = representation_id ? gslQueue.includes(representation_id) : false
const queuedDelegations = gslQueue.flatMap((delegationId) => {
const delegation = delegationsById[String(delegationId)]
@@ -107,7 +108,10 @@ export default function SpeakerList() {
-
+
Cessao
Cessao de Tempo
From 34a5a7534e2be0a25b9855b49ccd797fb7367419 Mon Sep 17 00:00:00 2001
From: Le-frances13 <100540487+Le-frances13@users.noreply.github.com>
Date: Sat, 29 Aug 2026 15:53:01 -0300
Subject: [PATCH 14/39] feat: timer disapears on unmoderated debate
---
frontend/src/components/session/top-bar.tsx | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/frontend/src/components/session/top-bar.tsx b/frontend/src/components/session/top-bar.tsx
index 3f954c0..54a1c47 100644
--- a/frontend/src/components/session/top-bar.tsx
+++ b/frontend/src/components/session/top-bar.tsx
@@ -2,13 +2,16 @@ import { Separator } from "@/components/ui/separator"
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
import Timer from "./timer"
import { useCommitteeStore } from "@/store/useCommitteeStore"
+import { States } from '@/schemas/types.gen';
-import Agenda from "./Agenda"
+import Agenda from "./Agenda"
export default function TopBar() {
const agendaTopics = useCommitteeStore((state) => state.agenda_topics)
const activeTopicIndex = useCommitteeStore((state) => state.active_topic_index)
+ const currentState = useCommitteeStore((state) => state.current_state)
+
const currentTopicLabel =
activeTopicIndex !== null && activeTopicIndex !== undefined && agendaTopics !== undefined && agendaTopics[activeTopicIndex] !== undefined
@@ -21,7 +24,10 @@ export default function TopBar() {
Conselho de Segurança
-
+ {currentState != States.UNMODERATED_CAUCUS &&
+
+ }
+
@@ -47,6 +53,6 @@ export default function TopBar() {
-
+
>)
}
\ No newline at end of file
From e22d9f2a7982514066221b1779ab56be90c87a16 Mon Sep 17 00:00:00 2001
From: Le-frances13 <100540487+Le-frances13@users.noreply.github.com>
Date: Sun, 30 Aug 2026 20:28:59 -0300
Subject: [PATCH 15/39] feat: delegation map halos effects when voting
---
.../src/components/session/delegation-map.tsx | 32 +++++++++++++++----
1 file changed, 26 insertions(+), 6 deletions(-)
diff --git a/frontend/src/components/session/delegation-map.tsx b/frontend/src/components/session/delegation-map.tsx
index 16eb8c9..369919d 100644
--- a/frontend/src/components/session/delegation-map.tsx
+++ b/frontend/src/components/session/delegation-map.tsx
@@ -23,6 +23,8 @@ import {
TooltipTrigger,
} from "@/components/ui/tooltip"
+import { States, VotingChoice } from '@/schemas/types.gen';
+
type DelegationMapProps = {
semicircleCount?: number
@@ -60,11 +62,28 @@ export default function DelegationMap({
const qualifiedMajority = Math.ceil((presentDelegations * 2) / 3)
const currentState = useCommitteeStore((state) => state.current_state)
- const ringColors : Record
= {
- "None" : "ring-sky-300/30",
- "Absent" : "ring-red-500/50",
- "Present" : "ring-yellow-500/50",
- "Present and Voting" : "ring-lime-600/50"
+ const votingRegistry = useCommitteeStore((state) => state.voting?.voting_registry ?? null)
+
+
+
+ const getDelegationRingColor = (state: string | undefined, presence: string | undefined, vote: VotingChoice | null) => {
+ switch (state) {
+ case States.ROLL_CALL:
+ if (presence === RollCallChoice.PRESENT_AND_VOTING) return "ring-green-700/50"
+ if (presence === RollCallChoice.PRESENT) return "ring-green-500/50"
+ if (presence === RollCallChoice.ABSENT) return "ring-red-500/50"
+ return "ring-sky-300/30"
+ case States.VOTING_EXECUTION:
+ if (vote === VotingChoice.FAVOUR) return "ring-green-500/50"
+ if (vote === VotingChoice.YES_WITH_RIGHTS) return "ring-green-300/50"
+ if (vote === VotingChoice.AGAINST) return "ring-red-500/50"
+ if (vote === VotingChoice.NO_WITH_RIGHTS) return "ring-red-300/50"
+ if (vote === VotingChoice.ABSTAIN) return "ring-gray-400/50"
+ return "ring-neutral-300/30"
+ default:
+ if (presence == RollCallChoice.PRESENT_AND_VOTING || presence === RollCallChoice.PRESENT) return "ring-sky-300/50"
+ return "ring-neutral-400/30"
+ }
}
return (
@@ -119,7 +138,8 @@ export default function DelegationMap({
const delegation = delegationsBySeat.get(seat)
const presence = rcregistry && delegation ? rcregistry[delegation.id] : "None"
- const ringcolor = ringColors[presence?? "None"]
+ const vote = votingRegistry && delegation ? votingRegistry[delegation.id] : null
+ const ringcolor = getDelegationRingColor(currentState, presence, vote)
if (!delegation) {
return
From 8ee93649049e6db97d8fe3fc3ff9c07fa7b49511 Mon Sep 17 00:00:00 2001
From: Le-frances13 <100540487+Le-frances13@users.noreply.github.com>
Date: Sun, 30 Aug 2026 20:30:28 -0300
Subject: [PATCH 16/39] fix: removal of not ready yet features
---
frontend/src/components/session/bottom-bar.tsx | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/frontend/src/components/session/bottom-bar.tsx b/frontend/src/components/session/bottom-bar.tsx
index d81f041..90d2d15 100644
--- a/frontend/src/components/session/bottom-bar.tsx
+++ b/frontend/src/components/session/bottom-bar.tsx
@@ -25,10 +25,19 @@ export default function BottomBar() {
{isChair && }
{isChair && }
-
+ {/*
+ TODO: Add history button when the history feature is implemented
+
+ */}
{isChair && }
- {!isChair && }
- {isChair && }
+ {/*
+ TODO: Add BRB button when the BRB feature is implemented
+ !isChair &&
+ */}
+ {/*
+ TODO: Add incident help button when the incident help feature is implemented
+ isChair &&
+ */}
>
From 93a7db96d902cfd6aeba286979230cc4e2251df2 Mon Sep 17 00:00:00 2001
From: Le-frances13 <100540487+Le-frances13@users.noreply.github.com>
Date: Sun, 30 Aug 2026 20:54:20 -0300
Subject: [PATCH 17/39] feat: roll call answer implementaiton
---
.../components/session/Sidebar/rollcall.tsx | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/frontend/src/components/session/Sidebar/rollcall.tsx b/frontend/src/components/session/Sidebar/rollcall.tsx
index ceaf75d..1c62cf5 100644
--- a/frontend/src/components/session/Sidebar/rollcall.tsx
+++ b/frontend/src/components/session/Sidebar/rollcall.tsx
@@ -1,5 +1,5 @@
import { useCommitteeStore } from "@/store/useCommitteeStore"
-import { RollCallChoice, SessionRoles } from "@/schemas/types.gen"
+import { RollCallChoice, SessionRoles, type AnswerRollCallEvent, DelegateEvents } from "@/schemas/types.gen"
import { Button } from "@/components/ui/button"
import {
Tooltip,
@@ -7,13 +7,18 @@ import {
TooltipTrigger,
} from "@/components/ui/tooltip"
import { useSession } from "@/context/SessionContext"
+import { sendMessage } from "@/context/SessionContext"
+
export default function RollCall() {
const presentDelegations = useCommitteeStore((state) => Object.entries(state.roll_call?.registry ?? {}).filter(([, choice]) => choice !== RollCallChoice.ABSENT).length)
const absentDelegations = useCommitteeStore((state) => Object.entries(state.roll_call?.registry ?? {}).filter(([, choice]) => choice === RollCallChoice.ABSENT).length)
const totalDelegations = useCommitteeStore((state) => Object.keys(state.delegations).length)
+ const rcregistry = useCommitteeStore((state) => state.roll_call?.registry ?? {})
+
const { role } = useSession()
+ const { representation_id } = useSession()
const isChair = role === SessionRoles.CHAIR
return (
@@ -55,7 +60,11 @@ export default function RollCall() {
-
+ sendMessage({ type: DelegateEvents.ANSWER_ROLL_CALL_EVENT, payload: { choice: RollCallChoice.PRESENT_AND_VOTING } } satisfies AnswerRollCallEvent)}
+ disabled={rcregistry[representation_id!] != null}
+ >
Presente e votante
@@ -65,7 +74,11 @@ export default function RollCall() {
-
+ sendMessage({ type: DelegateEvents.ANSWER_ROLL_CALL_EVENT, payload: { choice: RollCallChoice.PRESENT } } satisfies AnswerRollCallEvent)}
+ disabled={rcregistry[representation_id!] != null}
+ >
Presente
From 4a4e1ef9c029c346f214d349a85b51ce6da1f30f Mon Sep 17 00:00:00 2001
From: Le-frances13 <100540487+Le-frances13@users.noreply.github.com>
Date: Sun, 30 Aug 2026 20:54:40 -0300
Subject: [PATCH 18/39] fix: removed contaxt menu for delegate view
---
.../src/components/session/delegation-map.tsx | 154 ++++++++++--------
1 file changed, 87 insertions(+), 67 deletions(-)
diff --git a/frontend/src/components/session/delegation-map.tsx b/frontend/src/components/session/delegation-map.tsx
index 369919d..87be991 100644
--- a/frontend/src/components/session/delegation-map.tsx
+++ b/frontend/src/components/session/delegation-map.tsx
@@ -16,14 +16,15 @@ import {
import { useCommitteeStore } from "@/store/useCommitteeStore"
import { CircleFlag } from 'react-circle-flags'
import { sendMessage } from "@/context/SessionContext"
-import { type AddGslSpeakerEvent, type MarkRollCallEvent, type GrantFloorEvent , ChairEvents, RollCallChoice } from "@/schemas/types.gen"
+import { type AddGslSpeakerEvent, type MarkRollCallEvent, type GrantFloorEvent, ChairEvents, RollCallChoice } from "@/schemas/types.gen"
import {
Tooltip,
TooltipContent,
TooltipTrigger,
} from "@/components/ui/tooltip"
+import { useSession } from "@/context/SessionContext"
-import { States, VotingChoice } from '@/schemas/types.gen';
+import { States, VotingChoice, SessionRoles } from '@/schemas/types.gen';
type DelegationMapProps = {
@@ -36,6 +37,10 @@ export default function DelegationMap({
semicircleCount = 3,
buttonsPerSemicircle = 12,
}: DelegationMapProps) {
+
+ const { role } = useSession()
+ const isChair = role === SessionRoles.CHAIR
+
const circles = Array.from({ length: Math.max(1, semicircleCount) }, (_, i) => i)
const getSeatCount = (circleIndex: number) => {
@@ -64,7 +69,7 @@ export default function DelegationMap({
const votingRegistry = useCommitteeStore((state) => state.voting?.voting_registry ?? null)
-
+
const getDelegationRingColor = (state: string | undefined, presence: string | undefined, vote: VotingChoice | null) => {
switch (state) {
@@ -154,70 +159,85 @@ export default function DelegationMap({
transform: "translate(-50%, -50%)",
}}
>
-
-
-
-
-
-
-
-
-
-
-
- {/* TODO: Replace by country full name */}
-
- {delegation.name}
-
-
-
-
- Ações sobre a Delegação
- sendMessage({ type: ChairEvents.ADD_GSL_SPEAKER_EVENT, payload: { representation_id: delegation.id } } satisfies AddGslSpeakerEvent)}>
- Colocar na Lista de Discursos
-
- sendMessage({ type: ChairEvents.GRANT_FLOOR_EVENT, payload: { representation_id: delegation.id } } satisfies GrantFloorEvent)}>
- Dar a palavra
-
-
-
-
- Ausência Temporária
-
- Mudar Presença
-
- sendMessage({ type: ChairEvents.MARK_ROLL_CALL_EVENT, payload: { delegation_id: delegation.id, choice: RollCallChoice.PRESENT_AND_VOTING } } satisfies MarkRollCallEvent)}>
- Presente Votante
-
- sendMessage({ type: ChairEvents.MARK_ROLL_CALL_EVENT, payload: { delegation_id: delegation.id, choice: RollCallChoice.PRESENT } } satisfies MarkRollCallEvent)}>
- Presente
-
- sendMessage({ type: ChairEvents.MARK_ROLL_CALL_EVENT, payload: { delegation_id: delegation.id, choice: RollCallChoice.ABSENT } } satisfies MarkRollCallEvent)}>
- Ausente
-
-
-
-
-
-
-
-
- Punições
-
- Aviso Formal
- Expulsão
-
-
-
-
-
+ {isChair && (
+
+
+
+
+
+
+
+
+
+
+
+ {/* TODO: Replace by country full name */}
+
+ {delegation.name}
+
+
+
+
+ Ações sobre a Delegação
+ sendMessage({ type: ChairEvents.ADD_GSL_SPEAKER_EVENT, payload: { representation_id: delegation.id } } satisfies AddGslSpeakerEvent)}>
+ Colocar na Lista de Discursos
+
+ sendMessage({ type: ChairEvents.GRANT_FLOOR_EVENT, payload: { representation_id: delegation.id } } satisfies GrantFloorEvent)}>
+ Dar a palavra
+
+
+
+
+ Ausência Temporária
+
+ Mudar Presença
+
+ sendMessage({ type: ChairEvents.MARK_ROLL_CALL_EVENT, payload: { delegation_id: delegation.id, choice: RollCallChoice.PRESENT_AND_VOTING } } satisfies MarkRollCallEvent)}>
+ Presente Votante
+
+ sendMessage({ type: ChairEvents.MARK_ROLL_CALL_EVENT, payload: { delegation_id: delegation.id, choice: RollCallChoice.PRESENT } } satisfies MarkRollCallEvent)}>
+ Presente
+
+ sendMessage({ type: ChairEvents.MARK_ROLL_CALL_EVENT, payload: { delegation_id: delegation.id, choice: RollCallChoice.ABSENT } } satisfies MarkRollCallEvent)}>
+ Ausente
+
+
+
+
+
+
+
+
+ Punições
+
+ Aviso Formal
+ Expulsão
+
+
+
+
+ )}
+ {!isChair && (
+
+
+
+
+
+
+ )}
{delegation.name}
From 317888b8a0a68aa0a7107aa5184b028c0187e2e6 Mon Sep 17 00:00:00 2001
From: Extroias <91105220+Extroias@users.noreply.github.com>
Date: Sun, 30 Aug 2026 20:58:53 -0300
Subject: [PATCH 19/39] feat: Log Motion on frontend
---
backend/app/session/engine.py | 16 ++++++----------
.../session/bottom-bar-buttons/MotionsButton.tsx | 6 +++---
2 files changed, 9 insertions(+), 13 deletions(-)
diff --git a/backend/app/session/engine.py b/backend/app/session/engine.py
index 73b42da..d3eeba5 100644
--- a/backend/app/session/engine.py
+++ b/backend/app/session/engine.py
@@ -575,14 +575,15 @@ def apply_passed_motion(
debate_type=DebateTypes.MODERATED_DEBATE,
return_state=return_state,
total_duration_seconds=duration_seconds,
- per_speaker_seconds=motion.per_speaker_seconds,
+ per_speaker_seconds=motion.per_speaker_seconds if motion.per_speaker_seconds is not None
+ else state.gsl_default_time_seconds,
expires_at=datetime.now(UTC) + timedelta(seconds=duration_seconds),
)
reset_timer(
state,
motion.per_speaker_seconds
if motion.per_speaker_seconds is not None
- else 60,
+ else state.gsl_default_time_seconds,
)
case DebateTypes.UNMODERATED_DEBATE:
@@ -686,16 +687,11 @@ def handle_close_procedural_voting(
present = count_present_delegations(state)
passed = tally_votes(state.voting, present)
+
+ #TODO: Change this
effect = SessionEffect(
type=enums.SessionEffectType.VOTE_CLOSED,
- data={
- "present": present,
- "favour": sum(
- vote == enums.VotingChoice.FAVOUR
- for vote in state.voting.voting_registry.values()
- ),
- "passed": passed,
- },
+ data=state.voting,
)
if passed:
diff --git a/frontend/src/components/session/bottom-bar-buttons/MotionsButton.tsx b/frontend/src/components/session/bottom-bar-buttons/MotionsButton.tsx
index 8be3020..138a780 100644
--- a/frontend/src/components/session/bottom-bar-buttons/MotionsButton.tsx
+++ b/frontend/src/components/session/bottom-bar-buttons/MotionsButton.tsx
@@ -40,7 +40,7 @@ import {
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"
import { Label } from "@/components/ui/label"
import { useCommitteeStore } from "@/store/useCommitteeStore"
-import { MajorityTypes, States } from "@/schemas/types.gen"
+import { ChairEvents, MajorityTypes, MotionDecision, States, type LogMotionEvent } from "@/schemas/types.gen"
import { useSession } from "@/context/SessionContext"
import { SessionRoles } from "@/schemas/types.gen"
import {
@@ -319,12 +319,12 @@ export default function TestButton() {
{showMotionDecision && isChair && (
-
+ { sendMessage({ type: ChairEvents.LOG_MOTION_EVENT, payload: {...motionBody, decision: MotionDecision.DENY, representation_id: 0} } satisfies LogMotionEvent) }}>
Acatar moção
-
+ { sendMessage({ type: ChairEvents.LOG_MOTION_EVENT, payload: {...motionBody, decision: MotionDecision.DENY, representation_id: 0} } satisfies LogMotionEvent) }}>
Rejeitar moção
From 06e37c87e159b23779e421ceada8afad49ebe0e3 Mon Sep 17 00:00:00 2001
From: Extroias <91105220+Extroias@users.noreply.github.com>
Date: Sun, 30 Aug 2026 20:59:44 -0300
Subject: [PATCH 20/39] fix: voting result popup now works
We probably need to change how the SessionEffect payload typing works
---
backend/app/session/models.py | 5 ++++-
.../components/session/voting-results-popup.tsx | 16 ++++++++++++----
frontend/src/context/SessionContext.tsx | 16 +++++++++++++++-
frontend/src/schemas/types.gen.ts | 7 +------
4 files changed, 32 insertions(+), 12 deletions(-)
diff --git a/backend/app/session/models.py b/backend/app/session/models.py
index 566aa8b..0f845d6 100644
--- a/backend/app/session/models.py
+++ b/backend/app/session/models.py
@@ -150,9 +150,12 @@ class SessionLiveState(BaseModel):
has_veto_power: bool = False
+#Add more for other effects (Possibly change the Voting context, when doing that change frontend too)
+EffectPayloads = VotingContext
+
class SessionEffect(BaseModel):
type: enums.SessionEffectType
- data: dict[str, Any] = {}
+ data: EffectPayloads = {}
class DispatchOutcome(BaseModel):
diff --git a/frontend/src/components/session/voting-results-popup.tsx b/frontend/src/components/session/voting-results-popup.tsx
index 88b839b..f4fcc93 100644
--- a/frontend/src/components/session/voting-results-popup.tsx
+++ b/frontend/src/components/session/voting-results-popup.tsx
@@ -9,9 +9,9 @@ import {
} from "@/components/ui/dialog"
import { useCommitteeStore } from "@/store/useCommitteeStore"
-import { MajorityTypes, VotingChoice, RollCallChoice } from "@/schemas/types.gen"
+import { MajorityTypes, VotingChoice, RollCallChoice, type SessionEffect, type VotingContext } from "@/schemas/types.gen"
import { Button } from "@/components/ui/button"
-import { useState } from "react"
+import { useEffect, useState } from "react"
@@ -19,7 +19,7 @@ export default function VotingResultsPopup() {
- const voting = useCommitteeStore((state) => state.voting ?? null)
+ const [voting, setVoting] = useState
(null);
const voteTitle = voting?.title ?? voting?.motion_in_vote?.type ?? "ERROR:VotingTitle not found"
const expectedVotes = useCommitteeStore((state) => Object.entries(state.roll_call?.registry ?? {}).filter(([, choice]) => choice !== RollCallChoice.ABSENT).length)
@@ -57,8 +57,16 @@ export default function VotingResultsPopup() {
&& whoCanVeto.some((vetoId) => String(vetoId) === id))
})
- const [open, setOpen] = useState(true)
+ const [open, setOpen] = useState(false)
+ useEffect(()=>{
+
+ const setOp = (e:CustomEvent) => {setOpen(true); setVoting(e.detail.data as VotingContext)};
+
+ window.addEventListener("voteclose", setOp as EventListener);
+
+ return () => { window.removeEventListener("voteclose", setOp as EventListener)}
+ }, []);
return (
diff --git a/frontend/src/context/SessionContext.tsx b/frontend/src/context/SessionContext.tsx
index 2e37bd1..c2347a4 100644
--- a/frontend/src/context/SessionContext.tsx
+++ b/frontend/src/context/SessionContext.tsx
@@ -3,7 +3,7 @@ import { createContext, useEffect, useState } from 'react';
import { useAuth } from './AuthContext';
import { useParams } from 'react-router-dom';
import { UpdateStore } from '@/store/useCommitteeStore';
-import { type SessionEvent, type SessionRepresentation, type AuthenticateMessage, type ServerSessionMessage, type EventMessage } from '@/schemas/types.gen';
+import { type SessionEvent, type SessionRepresentation, type AuthenticateMessage, type ServerSessionMessage, type EventMessage, SessionEffectType, type SessionEffect } from '@/schemas/types.gen';
interface SessionContextType {
@@ -18,6 +18,15 @@ const SessionContext = createContext({
let socket: WebSocket | null = null
+
+
+// 2. Augment the global HTMLElementEventMap (or WindowEventMap)
+declare global {
+ interface HTMLElementEventMap {
+ 'voteclose': CustomEvent;
+ }
+}
+
export function SessionProvider({ children }: { children: ReactNode }) {
const { token } = useAuth()
const { sessionId } = useParams<{ sessionId: string }>();
@@ -58,6 +67,11 @@ export function SessionProvider({ children }: { children: ReactNode }) {
UpdateStore(data.state);
if (data.effect) {
console.log("Side effect / event result", data.effect);
+
+ if(data.effect?.type === SessionEffectType.VOTE_CLOSED){
+ const closeevnt = new CustomEvent("voteclose", {"detail": data.effect});
+ window.dispatchEvent(closeevnt); //possibly inefficient
+ }
}
break;
}
diff --git a/frontend/src/schemas/types.gen.ts b/frontend/src/schemas/types.gen.ts
index 571a06b..454ea43 100644
--- a/frontend/src/schemas/types.gen.ts
+++ b/frontend/src/schemas/types.gen.ts
@@ -1167,12 +1167,7 @@ export type RollCallContext = {
*/
export type SessionEffect = {
type: SessionEffectType;
- /**
- * Data
- */
- data?: {
- [key: string]: unknown;
- };
+ data?: VotingContext;
};
/**
From 25397d9524f8416e50bc08b6fe428e13622ca5ac Mon Sep 17 00:00:00 2001
From: Extroias <91105220+Extroias@users.noreply.github.com>
Date: Sun, 30 Aug 2026 21:03:38 -0300
Subject: [PATCH 21/39] fix: minor fix on close session
---
backend/app/session/engine.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/backend/app/session/engine.py b/backend/app/session/engine.py
index d3eeba5..bcb9115 100644
--- a/backend/app/session/engine.py
+++ b/backend/app/session/engine.py
@@ -425,10 +425,10 @@ def handle_close_session(
) -> DispatchOutcome:
require_chair(actor)
- if state.current_state not in (States.SETUP, States.ROLL_CALL, States.FINISHED):
+ if state.current_state in (States.SETUP, States.ROLL_CALL, States.FINISHED):
raise EventRejectedError(
code=enums.EventErrorCode.INVALID_STATE,
- message="Session may only be closed from setup, roll_call or finished",
+ message="Session may only be closed outside setup, roll_call or finished",
)
state.current_state = States.FINISHED
From 8c9008b6eb252b41e6948cfd610fb47de30bffd2 Mon Sep 17 00:00:00 2001
From: Le-frances13 <100540487+Le-frances13@users.noreply.github.com>
Date: Sun, 30 Aug 2026 21:08:45 -0300
Subject: [PATCH 22/39] feat: QOL session dialog closes as button is pressed
---
.../bottom-bar-buttons/SessionButton.tsx | 27 ++++++++++++++-----
1 file changed, 20 insertions(+), 7 deletions(-)
diff --git a/frontend/src/components/session/bottom-bar-buttons/SessionButton.tsx b/frontend/src/components/session/bottom-bar-buttons/SessionButton.tsx
index 8db02ea..327c8ab 100644
--- a/frontend/src/components/session/bottom-bar-buttons/SessionButton.tsx
+++ b/frontend/src/components/session/bottom-bar-buttons/SessionButton.tsx
@@ -1,6 +1,7 @@
import { Button } from "@/components/ui/button"
import {
Dialog,
+ DialogClose,
DialogContent,
DialogDescription,
DialogHeader,
@@ -51,19 +52,30 @@ export default function TestButton() {
{currentState === States.SETUP_ROOM &&
- sendMessage({ type: ChairEvents.OPEN_SESSION_EVENT, payload: {} } satisfies OpenSessionEvent)}>Abrir Sessao e iniciar Quórum }
+
+ sendMessage({ type: ChairEvents.OPEN_SESSION_EVENT, payload: {} } satisfies OpenSessionEvent)}>Abrir Sessao e iniciar Quórum
+
+ }
{currentState === States.ROLL_CALL &&
- sendMessage({ type: ChairEvents.CLOSE_ROLL_CALL_EVENT, payload: {} } satisfies CloseRollCallEvent)}>
- Fechar Quórum
- }
+
+ sendMessage({ type: ChairEvents.CLOSE_ROLL_CALL_EVENT, payload: {} } satisfies CloseRollCallEvent)}>
+ Fechar Quórum
+
+ }
{currentState !== States.SETUP_ROOM && currentState !== States.ROLL_CALL &&
- sendMessage({ type: ChairEvents.CLOSE_SESSION_EVENT, payload: {} } satisfies CloseSessionEvent)}>
- Fechar Sessão
- }
+
+ sendMessage({ type: ChairEvents.CLOSE_SESSION_EVENT, payload: {} } satisfies CloseSessionEvent)}>
+ Fechar Sessão
+
+ }
+ {/*
+ TODO: Implementar suspensão de sessão
Suspensão de sessão
Suspender Sessão
+
+ TODO: Implementar override de mudança de estado do comitê
Estado do Comitê
Estado atual do comitê: {String(currentState)}
@@ -83,6 +95,7 @@ export default function TestButton() {
Mudar Estado do Comitê
+ */}
From 56f05ff64a99dce383104bf8d7deabc6988ae6de Mon Sep 17 00:00:00 2001
From: Le-frances13 <100540487+Le-frances13@users.noreply.github.com>
Date: Sun, 30 Aug 2026 21:09:06 -0300
Subject: [PATCH 23/39] feat: QOL close roll call from sidebar
---
.../components/session/Sidebar/rollcall.tsx | 25 +++++++++++--------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/frontend/src/components/session/Sidebar/rollcall.tsx b/frontend/src/components/session/Sidebar/rollcall.tsx
index 1c62cf5..2eb487e 100644
--- a/frontend/src/components/session/Sidebar/rollcall.tsx
+++ b/frontend/src/components/session/Sidebar/rollcall.tsx
@@ -1,5 +1,5 @@
import { useCommitteeStore } from "@/store/useCommitteeStore"
-import { RollCallChoice, SessionRoles, type AnswerRollCallEvent, DelegateEvents } from "@/schemas/types.gen"
+import { RollCallChoice, SessionRoles, type AnswerRollCallEvent, DelegateEvents, ChairEvents, type CloseRollCallEvent } from "@/schemas/types.gen"
import { Button } from "@/components/ui/button"
import {
Tooltip,
@@ -18,7 +18,7 @@ export default function RollCall() {
const rcregistry = useCommitteeStore((state) => state.roll_call?.registry ?? {})
const { role } = useSession()
- const { representation_id } = useSession()
+ const { representation_id } = useSession()
const isChair = role === SessionRoles.CHAIR
return (
@@ -56,14 +56,19 @@ export default function RollCall() {
{presentDelegations} presentes e {absentDelegations} ausentes de {totalDelegations} delegacoes
+ {isChair &&
+ sendMessage({ type: ChairEvents.CLOSE_ROLL_CALL_EVENT, payload: {} } satisfies CloseRollCallEvent)}>
+ Fechar Quórum
+
+ }
{!isChair &&