mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-02-02 14:16:39 +01:00
Hide poll button if maxOptions <= 1
It's not a poll if there's only 1 option
This commit is contained in:
parent
6ccefaebe1
commit
9235d2c800
1 changed files with 24 additions and 16 deletions
|
@ -1219,22 +1219,30 @@ function Compose({
|
||||||
/>
|
/>
|
||||||
<Icon icon="attachment" />
|
<Icon icon="attachment" />
|
||||||
</label>{' '}
|
</label>{' '}
|
||||||
<button
|
{/* If maxOptions is not defined or defined and is greater than 1, show poll button */}
|
||||||
type="button"
|
{maxOptions == null ||
|
||||||
class="toolbar-button"
|
(maxOptions > 1 && (
|
||||||
disabled={
|
<>
|
||||||
uiState === 'loading' || !!poll || !!mediaAttachments.length
|
<button
|
||||||
}
|
type="button"
|
||||||
onClick={() => {
|
class="toolbar-button"
|
||||||
setPoll({
|
disabled={
|
||||||
options: ['', ''],
|
uiState === 'loading' ||
|
||||||
expiresIn: 24 * 60 * 60, // 1 day
|
!!poll ||
|
||||||
multiple: false,
|
!!mediaAttachments.length
|
||||||
});
|
}
|
||||||
}}
|
onClick={() => {
|
||||||
>
|
setPoll({
|
||||||
<Icon icon="poll" alt="Add poll" />
|
options: ['', ''],
|
||||||
</button>{' '}
|
expiresIn: 24 * 60 * 60, // 1 day
|
||||||
|
multiple: false,
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Icon icon="poll" alt="Add poll" />
|
||||||
|
</button>{' '}
|
||||||
|
</>
|
||||||
|
))}
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="toolbar-button"
|
class="toolbar-button"
|
||||||
|
|
Loading…
Reference in a new issue