mirror of
https://github.com/SableClient/Sable.git
synced 2026-11-20 09:01:17 -08:00
4 files changed
+29
-9
No files matched your search
@@ -191,7 +191,7 @@ export function PollEvent({ content, mEvent, mx, room }: PollEventProps) {
|
||||
const maxValue = Math.max(...Object.values(votes));
|
||||
let endText = 'The Poll has ended and';
|
||||
const winnerArray = answers.filter((item) => votes[item.id] === maxValue);
|
||||
if (votes.maxValue === 0) endText += ' nobody voted';
|
||||
if (maxValue === 0) endText += ' nobody voted';
|
||||
else if (winnerArray.length === 1 && winnerArray[0])
|
||||
endText += `${winnerArray[0][M_TEXT.name]} won`;
|
||||
else {
|
||||
@@ -223,7 +223,7 @@ export function PollEvent({ content, mEvent, mx, room }: PollEventProps) {
|
||||
// The choice of making it not the same size and style as an Attachment is deliberate as Polls tipically are Way more wordy and this feels more spacious
|
||||
return (
|
||||
<>
|
||||
<Box direction="Column" className={css.PollEvent} grow="Yes" gap="100">
|
||||
<Box direction="Column" className={css.PollEvent} grow="Yes" gap="200">
|
||||
<Box className={css.PollHeader} shrink="No">
|
||||
<Text>{questionBody} </Text>
|
||||
</Box>
|
||||
@@ -298,7 +298,13 @@ export function PollEvent({ content, mEvent, mx, room }: PollEventProps) {
|
||||
: ''}
|
||||
</Text>
|
||||
{!isEnded && canEnd && (
|
||||
<Button size="300" radii="400" variant="Critical" onClick={handleEndVote}>
|
||||
<Button
|
||||
size="300"
|
||||
radii="400"
|
||||
variant="Critical"
|
||||
fill="Soft"
|
||||
onClick={handleEndVote}
|
||||
>
|
||||
End Poll
|
||||
</Button>
|
||||
)}
|
||||
|
||||
@@ -1599,7 +1599,7 @@ export const RoomInput = forwardRef<HTMLDivElement, RoomInputProps>(
|
||||
size="300"
|
||||
radii="300"
|
||||
title={editorOldAddFile ? 'Upload File' : 'Add'}
|
||||
aria-label={editorOldAddFile ? 'Upload and attach a File' : 'Add more menu'}
|
||||
aria-label={editorOldAddFile ? 'Upload and attach a File' : 'Add new Item'}
|
||||
>
|
||||
<Icon src={Icons.PlusCircle} />
|
||||
</IconButton>
|
||||
|
||||
@@ -16,8 +16,8 @@ export const PollDialogTitle = style({
|
||||
});
|
||||
export const PollDialogAnswerBody = style({
|
||||
maxHeight: toRem(300),
|
||||
overflow: 'scroll',
|
||||
});
|
||||
export const PollDialogAnswerContainer = style({ paddingTop: toRem(4) });
|
||||
export const PollDialogAnswerInput = style({ width: '100%' });
|
||||
export const PollDialogMaxSelectionNumber = style({ width: toRem(80) });
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import {
|
||||
Chip,
|
||||
Switch,
|
||||
color,
|
||||
Scroll,
|
||||
} from 'folds';
|
||||
import { stopPropagation } from '$utils/keyboard';
|
||||
import type { ChangeEventHandler, KeyboardEventHandler } from 'react';
|
||||
@@ -204,9 +205,21 @@ export function PollDialog({ onCancel, mx, room, replyDraft, clearReplyDraft }:
|
||||
<Text size="B400">Add Option</Text>
|
||||
</Chip>
|
||||
</Box>
|
||||
<Box direction="Column" gap="100" className={css.PollDialogAnswerBody}>
|
||||
<Scroll
|
||||
hideTrack
|
||||
direction="Vertical"
|
||||
size="300"
|
||||
className={css.PollDialogAnswerBody}
|
||||
>
|
||||
{answers.map((item, index) => (
|
||||
<Box direction="Row" grow="Yes" shrink="No" alignItems="Center" key={item.id}>
|
||||
<Box
|
||||
className={css.PollDialogAnswerContainer}
|
||||
direction="Row"
|
||||
grow="Yes"
|
||||
shrink="No"
|
||||
alignItems="Center"
|
||||
key={item.id}
|
||||
>
|
||||
<Input
|
||||
variant={
|
||||
error?.errorcode === 'option' && item[M_TEXT.name].length === 0
|
||||
@@ -240,9 +253,9 @@ export function PollDialog({ onCancel, mx, room, replyDraft, clearReplyDraft }:
|
||||
/>
|
||||
</Box>
|
||||
))}
|
||||
</Box>
|
||||
</Scroll>
|
||||
</Box>
|
||||
<Box direction="Column">
|
||||
<Box direction="Column" gap="100">
|
||||
<SequenceCard
|
||||
className={SequenceCardStyle}
|
||||
variant="SurfaceVariant"
|
||||
@@ -300,6 +313,7 @@ export function PollDialog({ onCancel, mx, room, replyDraft, clearReplyDraft }:
|
||||
type="submit"
|
||||
variant="Primary"
|
||||
onClick={handleSubmit}
|
||||
fill="Soft"
|
||||
title="Create Poll"
|
||||
aria-label="Create Poll"
|
||||
>
|
||||
|
||||
Reference in new issue
Block a user