diff --git a/extend.php b/extend.php
index 6d4be766..7c8dfdac 100755
--- a/extend.php
+++ b/extend.php
@@ -26,7 +26,8 @@
return [
(new Extend\Frontend('forum'))
->js(__DIR__.'/js/dist/forum.js')
- ->css(__DIR__.'/resources/less/forum.less'),
+ ->css(__DIR__.'/resources/less/forum.less')
+ ->route('/polls', 'polls'),
(new Extend\Frontend('admin'))
->js(__DIR__.'/js/dist/admin.js')
diff --git a/js/src/forum/addPollsLink.js b/js/src/forum/addPollsLink.js
new file mode 100644
index 00000000..9138187a
--- /dev/null
+++ b/js/src/forum/addPollsLink.js
@@ -0,0 +1,17 @@
+import { extend } from 'flarum/common/extend';
+import IndexPage from 'flarum/forum/components/IndexPage';
+import LinkButton from 'flarum/common/components/LinkButton';
+
+import app from 'flarum/forum/app';
+
+export default function () {
+ extend(IndexPage.prototype, 'navItems', function (items) {
+ items.add(
+ 'polls',
+
+ Polls
+ ,
+ -11
+ );
+ });
+}
diff --git a/js/src/forum/components/Poll.tsx b/js/src/forum/components/Poll.tsx
new file mode 100644
index 00000000..d7407844
--- /dev/null
+++ b/js/src/forum/components/Poll.tsx
@@ -0,0 +1,74 @@
+import * as Mithril from 'mithril';
+import Component from 'flarum/common/Component';
+
+export default class IndexPolls extends Component {
+ view(): Mithril.Children {
+ return (
+
+
Polls
+
Lorem Ipsum Dolor Sit amet Consectetur Adipiscing Elit
+
+
+ );
+ }
+}
diff --git a/js/src/forum/components/PollsPage.js b/js/src/forum/components/PollsPage.js
new file mode 100644
index 00000000..105a52a4
--- /dev/null
+++ b/js/src/forum/components/PollsPage.js
@@ -0,0 +1,42 @@
+import app from 'flarum/forum/app';
+import Page from 'flarum/common/components/Page';
+import ItemList from 'flarum/common/utils/ItemList';
+import listItems from 'flarum/common/helpers/listItems';
+import IndexPage from 'flarum/forum/components/IndexPage';
+import Poll from './Poll';
+
+export default class PollsPage extends Page {
+ oninit(vnode) {
+ super.oninit(vnode);
+ }
+
+ oncreate(vnode) {
+ super.oncreate(vnode);
+ }
+
+ view() {
+ return (
+
+ {IndexPage.prototype.hero()}
+
+
+
+
+
+
+
+ );
+ }
+
+ sidebarItems() {
+ return IndexPage.prototype.sidebarItems();
+ }
+
+ navItems() {
+ return IndexPage.prototype.navItems();
+ }
+}
diff --git a/js/src/forum/extend.js b/js/src/forum/extend.js
index 17a40979..b9d1ffc2 100644
--- a/js/src/forum/extend.js
+++ b/js/src/forum/extend.js
@@ -3,6 +3,7 @@ import Post from 'flarum/common/models/Post';
import Forum from 'flarum/common/models/Forum';
import Discussion from 'flarum/common/models/Discussion';
import Poll from './models/Poll';
+import PollsPage from './components/PollsPage';
import PollOption from './models/PollOption';
import PollVote from './models/PollVote';
@@ -14,4 +15,7 @@ export default [
new Extend.Model(Forum).attribute('canStartPolls'),
new Extend.Model(Discussion).attribute('hasPoll').attribute('canStartPoll'),
+
+ // new Extend.Routes().add('polls', '/polls', ),
+ // new Extend.Routes().add('polls', '/polls'),
];
diff --git a/js/src/forum/index.js b/js/src/forum/index.js
index bf0b4400..8b0e9f56 100755
--- a/js/src/forum/index.js
+++ b/js/src/forum/index.js
@@ -2,17 +2,27 @@ import app from 'flarum/forum/app';
import addDiscussionBadge from './addDiscussionBadge';
import addComposerItems from './addComposerItems';
+import addPollsLink from './addPollsLink';
import addPollsToPost from './addPollsToPost';
import addPostControls from './addPostControls';
export * from './components';
export * from './models';
+import PollsPage from './components/PollsPage';
+
app.initializers.add('fof/polls', () => {
addDiscussionBadge();
addComposerItems();
+ addPollsLink();
addPollsToPost();
addPostControls();
+
+ // TMP
+ app.routes.polls = {
+ path: '/polls',
+ component: PollsPage,
+ };
});
export { default as extend } from './extend';
diff --git a/resources/less/forum.less b/resources/less/forum.less
index 8aef57c9..fc2ee822 100755
--- a/resources/less/forum.less
+++ b/resources/less/forum.less
@@ -99,7 +99,8 @@
}
.Checkbox.disabled {
- &, [disabled] {
+ &,
+ [disabled] {
cursor: not-allowed;
}
@@ -121,7 +122,8 @@
align-items: start;
.PollAnswer when (@fof-polls-options-color-blend = true) {
- &-checkbox, &-text {
+ &-checkbox,
+ &-text {
& when (@config-dark-mode =true) {
mix-blend-mode: difference;
}
@@ -169,7 +171,7 @@
}
&-voters {
- .Button--color-auto('button-primary');
+ .Button--color-auto("button-primary");
}
.Button {
@@ -184,7 +186,8 @@
}
.PollOption {
- &, .PollBar {
+ &,
+ .PollBar {
border-radius: 4px;
}
@@ -207,7 +210,7 @@
font-size: 85%;
font-weight: 600;
display: inline-block;
- padding: .1em .5em;
+ padding: 0.1em 0.5em;
border-radius: 4px;
background: transparent;
color: var(--muted-color);
@@ -275,7 +278,7 @@
);
background-size: var(--poll-option-width) 100%;
background-repeat: no-repeat;
- content: '';
+ content: "";
}
.PollAnswer {
@@ -394,3 +397,74 @@
background-size: var(--poll-option-width) 100%;
}
}
+
+.IndexPage-results.sideNavOffset {
+ display: flex;
+ flex-direction: column;
+}
+
+.IndexPage-toolbar {
+ order: 2;
+}
+
+.DiscussionList {
+ order: 3;
+}
+
+.Index-poll {
+ order: 1;
+ margin-bottom: 30px;
+}
+
+.aaa {
+ border-radius: 0.375rem;
+}
+
+.ba {
+ border-top-left-radius: 0.375rem;
+ border-top-right-radius: 0.375rem;
+}
+
+.bba {
+ border-bottom-right-radius: 0.375rem;
+ border-bottom-left-radius: 0.375rem;
+}
+.bbb {
+ display: flex;
+ position: relative;
+ padding: 1rem;
+ border-color: #d1d5db;
+ border-width: 1px;
+ border-style: solid;
+ cursor: pointer;
+ margin-top: -1px;
+}
+
+.ccc {
+ margin-top: 0.125rem;
+ flex-shrink: 0;
+ border-color: #d1d5db;
+ width: 1rem;
+ height: 1rem;
+ color: #4f46e5;
+ cursor: pointer;
+}
+
+.ddd {
+ display: flex;
+ margin-left: 0.75rem;
+ flex-direction: column;
+}
+
+.fff {
+ display: block;
+ font-size: 0.875rem;
+ line-height: 1.25rem;
+ font-weight: 500;
+}
+
+.ggg {
+ display: block;
+ font-size: 0.875rem;
+ line-height: 1.25rem;
+}