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
175 changes: 29 additions & 146 deletions docs/assets/api/schemas.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,12 @@
],
"properties": {
"minParticipantsPerCohort": {
"anyOf": [
{
"type": "null"
},
{
"minimum": 0,
"type": "integer"
}
]
"minimum": 0,
"type": ["null", "integer"]
},
"maxParticipantsPerCohort": {
"anyOf": [
{
"type": "null"
},
{
"minimum": 1,
"type": "integer"
}
]
"minimum": 1,
"type": ["null", "integer"]
},
"includeAllParticipantsInCohortCount": {
"type": "boolean"
Expand Down Expand Up @@ -674,7 +660,7 @@
"descriptions",
"progress",
"timeLimitInMinutes",
"requireFullTime",
"timeMinimumInMinutes",
"discussions"
],
"properties": {
Expand All @@ -697,24 +683,12 @@
"$ref": "#/$defs/StageProgressConfig"
},
"timeLimitInMinutes": {
"anyOf": [
{
"type": "number"
},
{
"type": "null"
}
]
"minimum": 1,
"type": ["integer", "null"]
},
"requireFullTime": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
]
"timeMinimumInMinutes": {
"minimum": 1,
"type": ["integer", "null"]
},
"discussions": {
"type": "array",
Expand Down Expand Up @@ -1308,27 +1282,13 @@
"type": "number"
},
"rankingStageId": {
"anyOf": [
{
"type": "null"
},
{
"type": "string"
}
]
"type": ["null", "string"]
},
"questionMap": {
"type": "object",
"patternProperties": {
"^(.*)$": {
"anyOf": [
{
"type": "number"
},
{
"type": "null"
}
]
"type": ["number", "null"]
}
},
"title": "QuestionMap"
Expand All @@ -1345,7 +1305,8 @@
"name",
"descriptions",
"progress",
"timeLimitInMinutes"
"timeLimitInMinutes",
"timeMinimumInMinutes"
],
"properties": {
"id": {
Expand All @@ -1367,17 +1328,12 @@
"$ref": "#/$defs/StageProgressConfig"
},
"timeLimitInMinutes": {
"anyOf": [
{
"type": "number"
},
{
"type": "null"
}
]
"minimum": 1,
"type": ["integer", "null"]
},
"requireFullTime": {
"type": "boolean"
"timeMinimumInMinutes": {
"minimum": 1,
"type": ["integer", "null"]
},
"isTurnBasedChat": {
"type": "boolean"
Expand All @@ -1386,14 +1342,7 @@
"type": "number"
},
"maxNumberOfTurns": {
"anyOf": [
{
"type": "number"
},
{
"type": "null"
}
]
"type": ["number", "null"]
},
"preventCancellation": {
"type": "boolean"
Expand Down Expand Up @@ -1819,14 +1768,7 @@
"type": "integer"
},
"maxParticipants": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
]
"type": ["integer", "null"]
}
},
"title": "Role"
Expand Down Expand Up @@ -2101,17 +2043,7 @@
]
},
"value": {
"anyOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "boolean"
}
]
"type": ["string", "number", "boolean"]
}
}
},
Expand Down Expand Up @@ -2273,14 +2205,7 @@
}
},
"correctAnswerId": {
"anyOf": [
{
"type": "null"
},
{
"type": "string"
}
]
"type": ["null", "string"]
},
"displayType": {
"title": "MultipleChoiceDisplayType",
Expand Down Expand Up @@ -2798,34 +2723,13 @@
"required": ["pronouns", "avatar", "name"],
"properties": {
"pronouns": {
"anyOf": [
{
"type": "null"
},
{
"type": "string"
}
]
"type": ["null", "string"]
},
"avatar": {
"anyOf": [
{
"type": "null"
},
{
"type": "string"
}
]
"type": ["null", "string"]
},
"name": {
"anyOf": [
{
"type": "null"
},
{
"type": "string"
}
]
"type": ["null", "string"]
}
}
},
Expand Down Expand Up @@ -3135,14 +3039,7 @@
]
},
"reasoningBudget": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
]
"type": ["integer", "null"]
},
"includeReasoning": {
"type": "boolean"
Expand Down Expand Up @@ -3784,14 +3681,7 @@
],
"properties": {
"wordsPerMinute": {
"anyOf": [
{
"type": "number"
},
{
"type": "null"
}
]
"type": ["number", "null"]
},
"minMessagesBeforeResponding": {
"type": "integer"
Expand All @@ -3800,14 +3690,7 @@
"type": "boolean"
},
"maxResponses": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
]
"type": ["integer", "null"]
},
"initialMessage": {
"type": "string"
Expand Down
28 changes: 19 additions & 9 deletions frontend/src/components/chat/chat_info_panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,11 @@ import {
ChatStageConfig,
ChatStagePublicData,
MediatorProfile,
MediatorStatus,
ParticipantProfile,
convertUnifiedTimestampToTime,
getTimeElapsed,
} from '@deliberation-lab/utils';
import {
getChatStartTimestamp,
getChatTimeRemainingInSeconds,
} from '../../shared/stage.utils';
import {getChatStartTimestamp} from '../../shared/stage.utils';
import {getHashBasedColor} from '../../shared/utils';
import {styles} from './chat_info_panel.scss';

Expand Down Expand Up @@ -57,12 +54,12 @@ export class ChatPanel extends MobxLitElement {
return html`
<div class="side-layout">
<stage-description .stage=${this.stage} noPadding> </stage-description>
${this.renderTimer(true)} ${this.renderParticipantList()}
${this.renderTimer()} ${this.renderParticipantList()}
</div>
`;
}

private renderTimer(showDivider = false) {
private renderTimer() {
if (!this.stage) return nothing;

const publicStageData = this.cohortService.stagePublicDataMap[
Expand Down Expand Up @@ -93,8 +90,21 @@ export class ChatPanel extends MobxLitElement {
class=${`countdown ${publicStageData.discussionEndTimestamp ? 'ended' : ''}`}
>
⏱️ Timer: ${this.stage.timeLimitInMinutes} minutes ${renderStatus()}
${this.stage.requireFullTime && !publicStageData.discussionEndTimestamp
? 'You must stay on this chat for the full time.'
${this.stage.timeMinimumInMinutes &&
!publicStageData.discussionEndTimestamp &&
publicStageData.discussionStartTimestamp &&
getTimeElapsed(publicStageData.discussionStartTimestamp, 'm') <
this.stage.timeMinimumInMinutes
? (() => {
const remaining = Math.ceil(
this.stage.timeMinimumInMinutes -
getTimeElapsed(
publicStageData.discussionStartTimestamp!,
'm',
),
);
return `You must stay in this chat for at least ${remaining} more minute${remaining !== 1 ? 's' : ''}.`;
})()
: ''}
</div>
${this.topLayout ? nothing : html`<div class="divider"></div>`}
Expand Down
Loading
Loading