diff --git a/js/src/forum/components/Poll.tsx b/js/src/forum/components/Poll.tsx index 9b4e2a4f..09504f98 100644 --- a/js/src/forum/components/Poll.tsx +++ b/js/src/forum/components/Poll.tsx @@ -12,6 +12,7 @@ import Button from 'flarum/common/components/Button'; import ItemList from 'flarum/common/utils/ItemList'; import { slug } from '../../common'; import PollControls from '../utils/PollControls'; +import Dropdown from 'flarum/common/components/Dropdown'; // Make translation calls shorter const t = app.translator.trans.bind(app.translator); @@ -31,28 +32,14 @@ export default class Poll extends Component { const poll = this.attrs.poll; const infoItems = this.infoItems(poll.maxVotes()); const state = this.state; + const controls = PollControls.controls(poll, this); + + controls.add('view', ()); + return (
-
-

{poll.question()}

- {poll.canSeeVoters() && ( - -
+ {this.controlsView(controls.toArray())}
@@ -87,6 +74,22 @@ export default class Poll extends Component { PollControls.editAction(this.attrs.poll); } + controlsView(controls: Mithril.ChildArray): Mithril.Children { + return ( + !!controls.length && ( + + {controls} + + ) + ); + } + infoItems(maxVotes: number) { const items = new ItemList(); const poll = this.attrs.poll;