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

Localise, rename and move everything to do with canvassing #2443

Open
wants to merge 31 commits into
base: main
Choose a base branch
from

Conversation

ziggabyte
Copy link
Contributor

Description

This PR adds localisation, changes some names, moves code around and attempts to make the code easier to manage.

Screenshots

none

Changes

  • renames the former "areas" section to "geography"
  • renames the former "outcomes" tab to "report"
  • splits the code into organiser-facing "areaAssignments" folder, and activist facing "canvass" folder
  • adds localisation to these features
  • renames what was formerly known as "places" to "locations"
  • changes names of files to match all these changes
  • merges in and adds translations for the work @rebecarubio has done on the instructions

Notes to reviewer

none - run the code and look at everything, I guess?

Related issues

none

Copy link
Member

@richardolsson richardolsson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't looked at all the code yet, but I found that the "instructions" tab (added by #2428) is not working. Just making that note here so that I don't forget it.

Copy link
Member

@richardolsson richardolsson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found the time to go through this massive piece of work. Nicely done!

I found some things that I think we should discuss (and some that I think are just mistakes that need to be fixed).

@@ -2,7 +2,7 @@ import mongoose from 'mongoose';
import { notFound } from 'next/navigation';
import { NextRequest, NextResponse } from 'next/server';

import { AreaModel } from 'features/areas/models';
import { AreaModel } from 'features/geography/models';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think I agree with this change. While yes, we have renamed the "Areas" section of the UI to "Geography", I feel like we still have a feature that should be called areas.

Compare this with how the "People" section is where the user fiends the lists/views, profile, joinform and duplicates features. Or how the smartSearch feature can be found in multiple UI sections.

Basically, my point is that there is no 1:1 relationship between a feature and where it goes in the UI. And in the case of this PR, we're not trying to rename the areas feature, but the "Areas" UI page.

},
]),
linearGradientDef(
messages.overview.progress.headers.households(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this string user-facing? It looks to me like it's an ID and that the "Households visited" string should have never been such a human-readable string

Suggested change
messages.overview.progress.headers.households(),
'householdsVisited'

This hunch is strengthened when I read the nivo documentation on the topic.

@@ -203,12 +224,12 @@ const AreaCard: FC<AreaCardProps> = ({
backgroundColor: (() => {
if (areaData?.area.id !== 'noArea') {
return dataPoint.serieId ===
'Household Visits'
messages.overview.progress.headers.households()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
messages.overview.progress.headers.households()
'householdsVisited'

? theme.palette.primary.light
: theme.palette.primary.dark;
} else {
return dataPoint.serieId ===
'Household Visits'
messages.overview.progress.headers.households()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
messages.overview.progress.headers.households()
'householdsVisited'

@@ -63,7 +63,7 @@ const MetricCard: FC<MetricCardProps> = ({
<Box display="flex" flexDirection="column" justifyContent="center">
{metric.kind == 'scale5' && (
<Typography fontStyle="italic" mb={1}>
The canvasser will respond by giving a rating from 1 to 5
The areaAssignee will respond by giving a rating from 1 to 5
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing internationalization.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, with regard to what term to use instead of "canvasser", I'm wondering if maybe we should go more neutral and just say "activist" in some places (where the context is enough to explain what kind of activist we're talking about).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was a concious desicion not to translate things on the "report" page, since it has not been designed and worked on yet.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with your thoughts about calling it "acitvist"!

import { ZetkinLocation } from '../types';
import { locationsLoad, locationsLoaded } from '../store';

export default function useLocations(orgId: number) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this and some other pure "locations" based things should move to it's own locations feature?

@@ -0,0 +1,34 @@
import { m, makeMessages } from 'core/i18n';

export default makeMessages('feat.geography', {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seeing this makes me second guess what I said about a "geography" feature. Because the map is indeed part of a geography "feature" rather than an "areas" feature.

I'm beginning to think that we should have all of these features:

  • Areas (the data, drawing, etc)
  • Area assignments (everything under the assignment, including it's map etc)
  • Canvass (the frontend)
  • Geography (the section and general-purpose map)

@@ -77,6 +77,9 @@ export default makeMessages('feat.campaigns', {
heading: m('Feedback and Surveys (none configured)'),
},
form: {
createAreaAssignment: {
defaultQuestion: m('Did you complete the mission?'),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the time to replace "mission", which feels so "big". Or am I the only one who feels that way? I would prefer "assignment" or "task", or something like that.

import EditPlace from './pages/EditPlace';
import Place from './pages/Place';
import Household from './pages/Household';
import HouseholdVisitPage from './pages/HouseholdVisitPage';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a better name. 😊


export default makeMessages('feat.canvass', {
default: {
assignment: m('Untitled area assignment'),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So far, we have used this as a fallback for assignments that have no title, and we do the same thing in multiple places (which means that this message exists in multiple places, right?).

This is not how it works for most other activities, e.g. call assignments, which must have a title. In those cases, we give it a default title when we create it. I think we should do that with area assignments too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants