Skip to content

Commit

Permalink
Sh/form UI (#90)
Browse files Browse the repository at this point in the history
* chore: design first iteration of refined polls

* refactor: break code down into components

* refactor: further break code down into components

* chore: dummy implementation

* refactor: use descriptive class names

* chore: minor styling changes

* chore: tinker with typescript

* feat: implement prototype of how results are shown

* chore: minor style changes

* refactor: break down logic

* chore: add dummy content for demo purposes

* chore: minor styling changes

* chore: add boilerplate state and model

* chore: work in progress

* Squashed commit of the following:

commit 69b47f9
Author: IanM <[email protected]>
Date:   Thu Feb 1 09:25:46 2024 +0000

    add isGlobal peroperty to js model

commit d130f6b
Author: IanM <[email protected]>
Date:   Thu Feb 1 09:21:04 2024 +0000

    list polls only shows global polls

commit 0a4dcf4
Author: IanM <[email protected]>
Date:   Wed Jan 31 16:49:15 2024 +0000

    add unauthorized api test

commit 6e52663
Author: IanM <[email protected]>
Date:   Wed Jan 31 16:45:33 2024 +0000

    fix: phpstan error

commit a322750
Author: StyleCI Bot <[email protected]>
Date:   Wed Jan 31 16:42:20 2024 +0000

    Apply fixes from StyleCI

commit c8e60a0
Author: IanM <[email protected]>
Date:   Wed Jan 31 16:42:10 2024 +0000

    feat: allow creation of polls without post id (global poll)

commit 7abeebe
Author: IanM <[email protected]>
Date:   Wed Jan 31 11:49:25 2024 +0000

    ensure poll is associated with postId

commit 20b5917
Author: StyleCI Bot <[email protected]>
Date:   Wed Jan 31 11:45:37 2024 +0000

    Apply fixes from StyleCI

commit fa69a3c
Author: IanM <[email protected]>
Date:   Wed Jan 31 11:45:24 2024 +0000

    test: create post poll via api

commit 97d6348
Author: IanM <[email protected]>
Date:   Wed Jan 31 08:34:08 2024 +0000

    fix: provider visibility

commit 03d355f
Author: IanM <[email protected]>
Date:   Wed Jan 31 08:32:26 2024 +0000

    fix: provider visibility

commit 325cc32
Author: StyleCI Bot <[email protected]>
Date:   Wed Jan 31 08:30:15 2024 +0000

    Apply fixes from StyleCI

commit 822ddbf
Author: IanM <[email protected]>
Date:   Wed Jan 31 08:29:56 2024 +0000

    chore: add test for existing create poll functionality via posts

commit 4799bba
Author: StyleCI Bot <[email protected]>
Date:   Tue Jan 30 14:37:24 2024 +0000

    Apply fixes from StyleCI

commit 4d197f3
Author: IanM <[email protected]>
Date:   Tue Jan 30 14:37:13 2024 +0000

    use sort

commit f897796
Author: IanM <[email protected]>
Date:   Tue Jan 30 14:26:03 2024 +0000

    chore: ts-ignore

commit f1e00db
Author: IanM <[email protected]>
Date:   Tue Jan 30 14:22:36 2024 +0000

    fix: return type

commit d56bf39
Author: StyleCI Bot <[email protected]>
Date:   Tue Jan 30 14:18:49 2024 +0000

    Apply fixes from StyleCI

commit d49c1f9
Author: IanM <[email protected]>
Date:   Tue Jan 30 14:18:37 2024 +0000

    feat: list polls controller

commit 8fb8cc6
Author: IanM <[email protected]>
Date:   Tue Jan 30 14:18:13 2024 +0000

    chore: format

commit ee37ee6
Author: IanM <[email protected]>
Date:   Tue Jan 30 14:15:49 2024 +0000

    fix: some model props incorrect

commit 1857a44
Author: StyleCI Bot <[email protected]>
Date:   Tue Jan 30 08:16:56 2024 +0000

    Apply fixes from StyleCI

commit 4b461a5
Author: IanM <[email protected]>
Date:   Tue Jan 30 08:16:27 2024 +0000

    wip: add polls route, begin to setup state, controls, etc

commit adf5393
Author: IanM <[email protected]>
Date:   Mon Jan 29 16:22:08 2024 +0000

    add nav item

commit d4032dc
Author: IanM <[email protected]>
Date:   Mon Jan 29 16:09:52 2024 +0000

    chore: ts

commit 7365c67
Author: IanM <[email protected]>
Date:   Mon Jan 29 14:01:09 2024 +0000

    chore: add tests for forum serializer props (#85)

    * chore: forum serializer test

    * Apply fixes from StyleCI

    ---------

    Co-authored-by: StyleCI Bot <[email protected]>

commit f460073
Author: IanM <[email protected]>
Date:   Mon Jan 29 11:46:12 2024 +0000

    chore: cleanup extend, create serializer mutators (#84)

    * chore: cleanup extend, create serializer mutators

    * Apply fixes from StyleCI

    ---------

    Co-authored-by: StyleCI Bot <[email protected]>

commit 9acbd74
Author: IanM <[email protected]>
Date:   Mon Jan 29 11:10:32 2024 +0000

    Chore: include discuss link

commit a2af115
Author: IanM <[email protected]>
Date:   Mon Jan 29 11:00:51 2024 +0000

    chore: use 1.x workflows

* create PollForm and adapt Create and EditPollModal

* Apply fixes from StyleCI

* wip

* style: format code

* feat: add start global poll button

* feat: add placeholder string keys

* chore: troubleshooting

* - remove legacy code from directory
- add simple acl abstraction
- add compose polls page

* - add compose poll hero
- adapt CreatePollHandler to the new data structure (similar to edit)
- add translations

* - pseudo fix poll visibility scope, requires review

* - implement frontend list and edit view for poll

* Apply fixes from StyleCI

* - implement poll detail view

* - format code

* - update poll detail view
- enhance poll list view

* refactor: change class name

* refactor: move edit, show results and delete buttons into controls dropdown.

* refactor: remove wrong css classes and add necessary ones

* feat: add missing en text keys

* feat: add link to polls page in session dropdown

* chore: cleanup

* Squashed commit of the following:

commit ce20ae8
Author: StyleCI Bot <[email protected]>
Date:   Thu Feb 15 12:19:33 2024 +0000

    Apply fixes from StyleCI

commit f2e6f32
Author: IanM <[email protected]>
Date:   Thu Feb 15 12:19:14 2024 +0000

    feat: optional poll subtitle

commit 69b47f9
Author: IanM <[email protected]>
Date:   Thu Feb 1 09:25:46 2024 +0000

    add isGlobal peroperty to js model

commit d130f6b
Author: IanM <[email protected]>
Date:   Thu Feb 1 09:21:04 2024 +0000

    list polls only shows global polls

commit 0a4dcf4
Author: IanM <[email protected]>
Date:   Wed Jan 31 16:49:15 2024 +0000

    add unauthorized api test

commit 6e52663
Author: IanM <[email protected]>
Date:   Wed Jan 31 16:45:33 2024 +0000

    fix: phpstan error

commit a322750
Author: StyleCI Bot <[email protected]>
Date:   Wed Jan 31 16:42:20 2024 +0000

    Apply fixes from StyleCI

commit c8e60a0
Author: IanM <[email protected]>
Date:   Wed Jan 31 16:42:10 2024 +0000

    feat: allow creation of polls without post id (global poll)

commit 7abeebe
Author: IanM <[email protected]>
Date:   Wed Jan 31 11:49:25 2024 +0000

    ensure poll is associated with postId

commit 20b5917
Author: StyleCI Bot <[email protected]>
Date:   Wed Jan 31 11:45:37 2024 +0000

    Apply fixes from StyleCI

commit fa69a3c
Author: IanM <[email protected]>
Date:   Wed Jan 31 11:45:24 2024 +0000

    test: create post poll via api

commit 97d6348
Author: IanM <[email protected]>
Date:   Wed Jan 31 08:34:08 2024 +0000

    fix: provider visibility

commit 03d355f
Author: IanM <[email protected]>
Date:   Wed Jan 31 08:32:26 2024 +0000

    fix: provider visibility

commit 325cc32
Author: StyleCI Bot <[email protected]>
Date:   Wed Jan 31 08:30:15 2024 +0000

    Apply fixes from StyleCI

commit 822ddbf
Author: IanM <[email protected]>
Date:   Wed Jan 31 08:29:56 2024 +0000

    chore: add test for existing create poll functionality via posts

commit 4799bba
Author: StyleCI Bot <[email protected]>
Date:   Tue Jan 30 14:37:24 2024 +0000

    Apply fixes from StyleCI

commit 4d197f3
Author: IanM <[email protected]>
Date:   Tue Jan 30 14:37:13 2024 +0000

    use sort

commit f897796
Author: IanM <[email protected]>
Date:   Tue Jan 30 14:26:03 2024 +0000

    chore: ts-ignore

commit f1e00db
Author: IanM <[email protected]>
Date:   Tue Jan 30 14:22:36 2024 +0000

    fix: return type

commit d56bf39
Author: StyleCI Bot <[email protected]>
Date:   Tue Jan 30 14:18:49 2024 +0000

    Apply fixes from StyleCI

commit d49c1f9
Author: IanM <[email protected]>
Date:   Tue Jan 30 14:18:37 2024 +0000

    feat: list polls controller

commit 8fb8cc6
Author: IanM <[email protected]>
Date:   Tue Jan 30 14:18:13 2024 +0000

    chore: format

commit ee37ee6
Author: IanM <[email protected]>
Date:   Tue Jan 30 14:15:49 2024 +0000

    fix: some model props incorrect

commit 1857a44
Author: StyleCI Bot <[email protected]>
Date:   Tue Jan 30 08:16:56 2024 +0000

    Apply fixes from StyleCI

commit 4b461a5
Author: IanM <[email protected]>
Date:   Tue Jan 30 08:16:27 2024 +0000

    wip: add polls route, begin to setup state, controls, etc

commit adf5393
Author: IanM <[email protected]>
Date:   Mon Jan 29 16:22:08 2024 +0000

    add nav item

commit d4032dc
Author: IanM <[email protected]>
Date:   Mon Jan 29 16:09:52 2024 +0000

    chore: ts

commit 7365c67
Author: IanM <[email protected]>
Date:   Mon Jan 29 14:01:09 2024 +0000

    chore: add tests for forum serializer props (#85)

    * chore: forum serializer test

    * Apply fixes from StyleCI

    ---------

    Co-authored-by: StyleCI Bot <[email protected]>

commit f460073
Author: IanM <[email protected]>
Date:   Mon Jan 29 11:46:12 2024 +0000

    chore: cleanup extend, create serializer mutators (#84)

    * chore: cleanup extend, create serializer mutators

    * Apply fixes from StyleCI

    ---------

    Co-authored-by: StyleCI Bot <[email protected]>

commit 9acbd74
Author: IanM <[email protected]>
Date:   Mon Jan 29 11:10:32 2024 +0000

    Chore: include discuss link

commit a2af115
Author: IanM <[email protected]>
Date:   Mon Jan 29 11:00:51 2024 +0000

    chore: use 1.x workflows

* chore: cleanup

* Apply fixes from StyleCI

* Refactor Poll related components and methods for better readability and error handling

* refactor: Add subtitle field to PollForm component

* Add check for undefined voteCount and update localization strings in PollListItem component

* Refactor PollResults component to use real data and add overallVoteCount method to PollState

* bugfix: fix bug about saving polls from posts etc. and add missing texts

* fix tests

* minor cleanup

* switch to yarn

* more cleanup

* fix compose route reload

* fix create poll

* fix edit existing post poll

* create dedicated poll view route

* refactor: add PollViewPage

* refactor: merged Subtitle and title component into PollView using ListItems & the vote button is now showing up and working

* format

* fix poll compose

* update icons, begin removing acl

* fix edit polls

* refactor: use ItemList approach for form part in PollView

* bugfix: fix when which data is provided in the form for the options for create and edit

* remove acl

* export components

* export states

* add nav to poll compose

* refactor: improve markup and css classes assignment for PostListItem

* style: improve Poll list style

* build js for demo/alpha release

* format and build

* style: add basic style for poll result bar and center icon in poll composer icon buttons

* refactor: add class and text key to poll modal delete button

* feat: add percentage position indicator in poll result bar

* format

* feat: use submit button as separate component for possible customization (animation, etc) via extend function

* Build

* fix: change syntax for delete success message

* feat: add sr only text to form

* feat: improve accessibility

* chore: remove comments

* feat: further improve accessibility

* chore: missing code replication

Perhaps it would make sense to refactor this..

* feat: use poll question as meta title

* refactor: use other icons for poll controls

Use the same as when editing or deleting discussions.

* chor: move PollForm to tsx format

* chor: move both Modal to tsx format

* wip: pollshowcase + refactoring

---------

Co-authored-by: Davide Iadeluca <[email protected]>
Co-authored-by: StyleCI Bot <[email protected]>
Co-authored-by: Gianni Guida <[email protected]>
Co-authored-by: IanM <[email protected]>
  • Loading branch information
5 people authored Feb 27, 2024
1 parent ce20ae8 commit 11d900d
Show file tree
Hide file tree
Showing 55 changed files with 4,668 additions and 6,666 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

frontend_directory: ./js
backend_directory: .
js_package_manager: npm
js_package_manager: yarn
main_git_branch: master

secrets:
Expand Down
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"title": "FoF Polls",
"category": "discussion",
"icon": {
"name": "fas fa-signal",
"name": "fas fa-poll",
"backgroundColor": "#e74c3c",
"color": "#fff"
}
Expand All @@ -59,7 +59,8 @@
},
"require-dev": {
"flarum/phpstan": "*",
"flarum/testing": "^1.0.0"
"flarum/testing": "^1.0.0",
"fof/upload": "*"
},
"scripts": {
"analyse:phpstan": "phpstan analyse",
Expand Down
8 changes: 5 additions & 3 deletions extend.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@
use Flarum\Post\Post;
use Flarum\Settings\Event\Saved as SettingsSaved;
use FoF\Polls\Api\Controllers;
use FoF\Polls\Api\Serializers\PollSerializer;

return [
(new Extend\Frontend('forum'))
->js(__DIR__.'/js/dist/forum.js')
->css(__DIR__.'/resources/less/forum.less')
->route('/polls', 'fof_polls_directory', Content\PollsDirectory::class),
->route('/polls', 'fof.polls.showcase')
->route('/polls/all', 'fof.polls.list', Content\PollsDirectory::class)
->route('/polls/view/{id}', 'fof.poll.view')
->route('/polls/composer', 'fof.polls.composer'),

(new Extend\Frontend('admin'))
->js(__DIR__.'/js/dist/admin.js')
Expand Down Expand Up @@ -57,7 +59,7 @@
->attributes(Api\AddDiscussionAttributes::class),

(new Extend\ApiSerializer(PostSerializer::class))
->hasMany('polls', PollSerializer::class)
->hasMany('polls', Api\Serializers\PollSerializer::class)
->attributes(Api\AddPostAttributes::class),

(new Extend\ApiSerializer(ForumSerializer::class))
Expand Down
2 changes: 1 addition & 1 deletion js/dist/admin.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion js/dist/admin.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion js/dist/forum.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/dist/forum.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit 11d900d

Please sign in to comment.