Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New survey page based on Next.js v13 using the app router and server actions #1756

Merged
Show file tree
Hide file tree
Changes from 92 commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
78414d5
Create boilerplate for activist portal pages
richardolsson Nov 10, 2023
bb3a4f7
WIP
kaulfield23 Nov 11, 2023
372d698
Render survey elements
henrycatalinismith Nov 11, 2023
48041b1
Add org name + avatar, form title + desc, and render form inputs
henrycatalinismith Nov 11, 2023
077debb
create signUpOptions
kaulfield23 Nov 11, 2023
4d7632e
Survey submit button
henrycatalinismith Nov 11, 2023
eaf3dff
Add playwright test for submitting a survey
richardolsson Nov 11, 2023
8b3a969
Remove test.only flag
richardolsson Nov 11, 2023
c1a3128
Adds checkbox and description of privacy policy.
MattettaM Nov 11, 2023
fdc2ec3
Added additional localization for submission button
MattettaM Nov 11, 2023
ae915ae
Fix playwright test
henrycatalinismith Nov 11, 2023
810bf6b
add sign in options for user
cougarhighland Nov 11, 2023
6b0e75a
fix error
cougarhighland Nov 11, 2023
3808bc3
Fixes
henrycatalinismith Nov 11, 2023
83a10a0
Create components for each survey element
henrycatalinismith Nov 11, 2023
67403fc
Fix the playwright test for the new survey page
henrycatalinismith Nov 12, 2023
df4815c
Align new survey signature formdata with old survey
henrycatalinismith Nov 12, 2023
5abe9b3
Add email:string to ZetkinUser
henrycatalinismith Nov 12, 2023
4f7c6e8
Load survey in getServerSideProps and add error handling
henrycatalinismith Nov 12, 2023
eefa86a
Form styling
cougarhighland Nov 12, 2023
cec25a9
Merging conflicts
MattettaM Nov 12, 2023
8a25dee
Simplify unnecessarily circuitous control flow
henrycatalinismith Nov 17, 2023
0524740
Replace Node-style redirect with Next-style redirect
henrycatalinismith Nov 17, 2023
ae49877
Eliminate non-null assertion operator
henrycatalinismith Nov 17, 2023
2085680
Use ZetkinSurveyQuestionResponse instead of redeclaring
henrycatalinismith Nov 17, 2023
27a74ec
Localize survey submitted page and add 404 handling
henrycatalinismith Nov 17, 2023
2e64d55
Remove duplicate demo-radio-buttons-group-label
henrycatalinismith Nov 24, 2023
11f291c
Preserve TextQuestion input field state on error
henrycatalinismith Nov 15, 2023
6b3ff04
Default to widget_type === 'select'
henrycatalinismith Nov 25, 2023
895c28a
Get error bg color from theme
henrycatalinismith Nov 25, 2023
e93ec84
Add survey email signature playwright test
henrycatalinismith Nov 25, 2023
409eee0
Survey signature
henrycatalinismith Nov 25, 2023
8097b98
Tidy up survey elements
henrycatalinismith Nov 25, 2023
832e194
Tweak according to PR feedback
henrycatalinismith Dec 7, 2023
07a2be0
Replace h1 with Typography
henrycatalinismith Dec 9, 2023
b9b46c9
Add text block heading to survey page
henrycatalinismith Dec 10, 2023
bc15826
Add test coverage for survey API submission code
henrycatalinismith Dec 10, 2023
f6776fa
Create SurveyOption component to unify radio & checkbox styling
henrycatalinismith Dec 17, 2023
938e1a7
Apply WAI-ARIA form control grouping semantics to privacy policy
henrycatalinismith Dec 18, 2023
cfc3fdf
Add SurveySubheading component to unify heading typography
henrycatalinismith Dec 17, 2023
233b5b7
Move survey page router code to app router file
henrycatalinismith Dec 28, 2023
0ec3d5a
Get the page to actually render
henrycatalinismith Dec 30, 2023
6677212
Rename EnvWrapper to ClientContext and add mui providers
henrycatalinismith Dec 31, 2023
162f8ac
Export store from core/store
henrycatalinismith Jan 1, 2024
5debb34
Patch getBrowserLanguage to work with the Next.js app router
henrycatalinismith Jan 1, 2024
671fe41
Load i18n messages in the root layout and pass to client context
henrycatalinismith Jan 1, 2024
ead0431
Comment out the user survey signature option
henrycatalinismith Jan 1, 2024
e2df6d3
Port survey submission handling code to app router
henrycatalinismith Jan 1, 2024
e7df6b4
Try out server actions
henrycatalinismith Jan 7, 2024
39d33c5
Get server action working
henrycatalinismith Jan 21, 2024
69a7e39
Fetch survey in server component, pass to client component
henrycatalinismith Jan 23, 2024
4ea40f2
Enable + fix submits anonymous signature playwright test for survey page
henrycatalinismith Jan 24, 2024
c305842
Make the error handling playwright test pass in the new survey form
henrycatalinismith Jan 26, 2024
74a749b
Update lockfile after merge
richardolsson Feb 25, 2024
e270d41
Default to radio buttons when no question type is specified
henrycatalinismith Feb 26, 2024
9f2480d
Implement mobile survey design from Figma
henrycatalinismith Mar 16, 2024
d5741b7
Implement desktop layout
henrycatalinismith Mar 16, 2024
62b1adc
Tidy up survey submitted page
henrycatalinismith Mar 16, 2024
7e62631
Implement missing functionality
henrycatalinismith Mar 16, 2024
1f051ef
Fix playwright tests
henrycatalinismith Mar 16, 2024
c00f14e
Fix layout when options are very very long
henrycatalinismith Mar 16, 2024
2f3d49c
Add hideOrganization parameter for iframe use case
henrycatalinismith Mar 16, 2024
509aea0
Fix out-of-range error about default dropdown value
henrycatalinismith Mar 16, 2024
682d865
Add survey metadata to HTML head
henrycatalinismith Mar 16, 2024
aa7c273
Update survey URL
henrycatalinismith Mar 16, 2024
7a98c28
Reinstate legacy redirect for all activist portal paths except surveys
henrycatalinismith Mar 16, 2024
18b1b06
Address a whole batch of PR feedback
henrycatalinismith Mar 17, 2024
a070baa
Remove placeholder metadata
henrycatalinismith Mar 17, 2024
bf02af2
Merge branch 'main' into issue-1620/next-v13-survey-page-with-app-rou…
henrycatalinismith Mar 17, 2024
d18e9ba
Enable signing survey as authenticated user
henrycatalinismith Mar 17, 2024
de1a5bf
Replace signature hack with original implementation which has mysteri…
henrycatalinismith Mar 17, 2024
f04d390
Remove spurious redirect
henrycatalinismith Mar 17, 2024
a14c242
Remove .only
henrycatalinismith Mar 17, 2024
dee0778
Merge pull request #1845 from zetkin/issue-1620/auth-fix
richardolsson Mar 17, 2024
445e60f
Scroll to survey error on mount
henrycatalinismith Mar 17, 2024
db0c913
Fix server-rendered CSS in app router
henrycatalinismith Mar 17, 2024
83d7874
Merge pull request #1848 from zetkin/issue-1620/ssg-css
henrycatalinismith Mar 17, 2024
0256136
Merge pull request #1850 from zetkin/issue-1620/error-scroll
henrycatalinismith Mar 17, 2024
da3c16d
Undo accidental package installs
henrycatalinismith Mar 17, 2024
b5cc44c
Do navigation in test cases, not in beforeEach()
richardolsson Mar 27, 2024
5a23bea
Add test case and fix bug that occurred when not interacting with <se…
richardolsson Mar 27, 2024
867db13
Merge pull request #1866 from zetkin/undocumented/survey-select-widge…
richardolsson Mar 27, 2024
3bc0f5a
Fix checkbox input in new survey submission handler code
henrycatalinismith Mar 29, 2024
dfc47a6
Add playwright test for multiple checkbox inputs
henrycatalinismith Mar 29, 2024
f2aacdd
Mark required text input as required
henrycatalinismith Mar 30, 2024
ba268e1
Implement hidden and required survey elements
henrycatalinismith Mar 30, 2024
8011a09
Merge pull request #1871 from zetkin/issue-1620/question-options
henrycatalinismith Mar 31, 2024
18577e4
Add aria-describedby directly to select element in survey
henrycatalinismith Mar 31, 2024
a72860d
Merge branch 'main' into issue-1620/next-v13-survey-page-with-app-rou…
henrycatalinismith Apr 2, 2024
0309345
Merge branch 'main' into issue-1620/next-v13-survey-page-with-app-rou…
henrycatalinismith May 12, 2024
0265ec7
Fix survey URL generation
henrycatalinismith May 24, 2024
c769c49
Merge branch 'main' into issue-1620/next-v13-survey-page-with-app-rou…
henrycatalinismith Jun 18, 2024
0fc2dd8
Merge branch 'main' into issue-1620/next-v13-survey-page-with-app-rou…
henrycatalinismith Jun 30, 2024
1c1656b
Fix linter errors and remove unused commented-out code
henrycatalinismith Jun 30, 2024
9373c75
Suppress erroneous TypeScript error about nonexistent useFormState ex…
henrycatalinismith Jun 30, 2024
ac213e0
Move old @ts-ignore comment back alongside the import it was original…
henrycatalinismith Jul 1, 2024
5422a03
Merge branch 'main' into issue-1620/next-v13-survey-page-with-app-rou…
henrycatalinismith Aug 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
import KPD from '../..';
import {
ELEMENT_TYPE,
RESPONSE_TYPE,
ZetkinSurveyExtended,
} from 'utils/types/zetkin';

const KPDMembershipSurvey: ZetkinSurveyExtended = {
access: 'open',
callers_only: false,
campaign: null,
elements: [
{
hidden: false,
id: 1,
question: {
description: '',
options: [
{
id: 1,
text: 'Yes',
},
{
id: 2,
text: 'No',
},
],
question: 'Do you want to be active?',
required: false,
response_config: {
widget_type: 'radio',
},
response_type: RESPONSE_TYPE.OPTIONS,
},
type: ELEMENT_TYPE.QUESTION,
},
{
hidden: false,
id: 2,
question: {
description: '',
question: 'What would you like to do?',
required: false,
response_config: {
multiline: true,
},
response_type: RESPONSE_TYPE.TEXT,
},
type: ELEMENT_TYPE.QUESTION,
},
{
hidden: false,
id: 3,
question: {
description: '',
options: [
{
id: 1,
text: 'Flyers',
},
{
id: 2,
text: 'Phone banking',
},
],
question: 'How do you want to help?',
required: false,
response_config: {
widget_type: 'checkbox',
},
response_type: RESPONSE_TYPE.OPTIONS,
},
type: ELEMENT_TYPE.QUESTION,
},
],
expires: null,
id: 1,
info_text: '',
org_access: 'sameorg',
organization: {
id: KPD.id,
title: KPD.title,
},
published: '1857-05-07T13:37:00.000Z',
signature: 'allow_anonymous',
title: 'Membership survey',
};

export default KPDMembershipSurvey;
Loading
Loading