Closed kulla closed 3 years ago
Thank you @kulla for writing this up!
The next step would be to extract the relevant features (e.g. blockers) for the current milestone.
So the parts are:
Next to the explanation a call to action is shown, when the current user is not logged in or does not belong to the given community.
Information currently not supported, frontend auth only provides username. I guess it's okay to always display the CTA until we need to expand the auth info for some other feature anyway. Okay @kulla ?
Also, we provide the user id to the donation form atm.
const encodedCampaignId = encodeURIComponent(
`Spendenprofil { userId: 0, userName: ${username} }`
)
How important is this (since usernames are unique i guess)? (again currently this information is not available)
Next to the explanation a call to action is shown, when the current user is not logged in or does not belong to the given community.
Information currently not supported, frontend auth only provides username. I guess it's okay to always display the CTA until we need to expand the auth info for some other feature anyway. Okay @kulla ?
Also, we provide the user id to the donation form atm.
const encodedCampaignId = encodeURIComponent( `Spendenprofil { userId: 0, userName: ${username} }` )
How important is this (since usernames are unique i guess)? (again currently this information is not available)
This is okay to have it this way. Can you create a follow up issue with the missing stuff.
How can I have a look at a profile. https://frontend-git-community-features-for-profiles.serlo.vercel.app/user/profile/kulla does not seem to work...
e.g. /user/profile/18981 works. I focused on the frontend, not sure if we implement routing (usernames, /me …) in the frontend or in the SW. Let's discuss this tonight maybe.
Okay, I found a simple way to get the user id and use it for the donation form.
Implemented in staging
The following features should be implemented from the project "Community Upgrade".
General information
Users of Serlo can be active authors / active reviewers / active donors. Whether they are included in these communities can be requested from the API. Thus the type
User
has the following additional properties:The features shall only be available in the German version.
Badges next to links ✅
Next to a link to a user profile there shall be badges displayed for each type of community the user belongs to:
The badges are:
The order of badges is:
User profiles (path
/user/profile/...
)On the top of the user profile there is a banner showing the types of the communities the user belongs to:
Bird image
The first image in the following list is used:
Example: When a user is active author and active donor, then the picture for active author is shown.
Explanation of communities
All communities the user belongs to, are explained. Here the badge is shown, together with an explanation text. The explanation texts are defined in https://github.com/serlo/serlo.org/blob/a54b908690c06718749f44707b58d5c04f22c7b8/packages/public/client/src/feature-prototypes/donation-profiles.ts#L32-L61 -> see the properties
otherUserProfileMessage
(%username%
needs to be replaced with the username of the user the profile belongs to).Next to the explanation a call to action is shown, when the current user is not logged in or does not belong to the given community.
Own user profile (
/user/me
)On top of the own profile also the banner is shown as described in the previous section. However the explanatory texts are different (see properties
ownProfileMessage
in https://github.com/serlo/serlo.org/blob/a54b908690c06718749f44707b58d5c04f22c7b8/packages/public/client/src/feature-prototypes/donation-profiles.ts#L32-L61 ) ->%no%
need to be exchanged with the current number in the respective community. The call to action is not shownDonation form
If the user is not an active donor a form is displayed to him. The short version is:
The long version is (click on "mehr anzeigen"):
The last sentence "Kannst du dir vorstellen, unsere Arbeit als Spenderin bzw. Spender zu fördern und Teil der Community zu werden? Dann nutze bitte das Formular rechts." is replaced with "Du bist schon Teil dieser Community. Kannst du dir dennoch vorstellen, auch einen kleinen finanziellen Beitrag zu leisten? Dann nutze bitte das Formular rechts." when the user is an active author or active reviewer.
The form url (iframe) is
https://spenden.twingle.de/serlo-education-e-v/spendenprofil/tw5e8dbb1390e8b/page?tw_cid=${encodedCampaignId}
wherebyYou can see the current HTML at https://github.com/serlo/serlo.org/blob/a54b908690c06718749f44707b58d5c04f22c7b8/packages/public/client/src/feature-prototypes/donation-profiles.ts#L149-L173
The height of the iframe can be dynamically changed with the code https://github.com/serlo/serlo.org/blob/a54b908690c06718749f44707b58d5c04f22c7b8/packages/public/client/src/feature-prototypes/donation-profiles.ts#L125-L136