Coder Social home page Coder Social logo

karina-klinkeviciute / rainbow-challenge-front Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 2.0 3.41 MB

Frontend for the app RainbowChallenge

License: Other

Kotlin 0.03% Swift 0.08% Objective-C 0.01% Dart 99.63% Ruby 0.26%
lgbt lgbtqia activism human-rights flutter dart

rainbow-challenge-front's Introduction

rainbow_challenge

License

Rainbow Challenge is licensed by the MIT license. Full license in the LICENSE file

About Rainbow Challenge

Rainbow challenge is a project meant to help young LGBTQIA+ activists to get involved in the activism and protection of LGBTQIA+ rights.

Rainbow challenge app

This app helps people, especially youth to get involved in the LGBTQIA+ activism and support in a captivating and rewarding way.

Backend of the app

Backend of the app is in another repository which is also licensed by the MIT license: https://github.com/karina-klinkeviciute/rainbow-challenge

Theme

Custom classes:

  • ThemeColors()
  • ThemeFonts()
  • ThemeHeadings()

Fonts

Custom fonts for the project are described in lib/theme/fonts.dart.

Colors

Custom colors for the project are described in lib/theme/colors.dart.

Colors for various built-in widgets are described in lib/theme/design_theme.dart. Some descriptions are work-in-progress, the light mode is more complete than the dark mode.

Icons

We combine our own icons with Material icons in the project.

Material icons

List of material icons can be found here »

Custom Widgets

Custom widgets can be found in lib > widgets. They can be reused in different places of the app.

  • BottomMenuWidget() - a bottom navigation bar that uses the built-in MaterialApp BottomNavigationBar widget. The built-in widget has limited options for visual effects (item border is not available at the moment), but it's easier to implement than a widget made from scratch. Perhaps there are possibilities to add more visual flexibility (further research is needed).

  • ColoredAreaWidget({ backgroundColor, required content }) - this widget adds an area with background and rounded corners. Background color has a default value.

  • HeadingLinedWidget({ required title }) - this widget displays a centered heading that contains a centered heading surrounded by horizontal lines

  • HeadlineWidget({ required title, subtitle }) - this widget adds a styled headline that consists of the main title and subtitle (optional) of the page/screen.

  • HtmlWidget({ required data, center }) - this widget uses html rendering with some styles added to it. It uses package flutter_html. The idea behind this widget is to add some visual consistency wherever html will be rendered in the app. Especially useful for various descriptions (e.g. challenges) and news articles.

  • ImageExternalWidget({ required url, width, height, borderRadius }) - this widget adds an external image with some styling and clipping added to it.

  • ImageLocalWidget({ required url, width, height, borderRadius }) - this widget adds a local image with some styling and clipping added to it.

  • MessageWidget( { icon, title, message }) - displays a vertically and horizontally centered area that contains an icon, title and message. In the future we will probably add some illustrations to it.

  • WrapperSimpleWidget({ required mainArea, bodyBackgroundColor }) - displays a Scaffold structure with minimal setup with fullscreen body.

  • WrapperMainWidget( { required mainArea, bodyBackgroundColor }) - displays a Scaffold structure with standard setup.

  • StatsWidget({ required label, required number, icon, localIcon}) - displays a column with a label, big number and icon. Icon can be added in two ways: by choosing a local asset(use localIcon) or an icon from icons library(use icon). Suitable for displaying stats.

  • ChallengeHeadlineWidget({ required title, required points }) - displays a headline in single challenge page templates. It includes the title and points. UI work is in progress.

  • ChallengeDescriptionWidget({ description }) - displays a description in single challenge page if it exists. Uses HtmlWidget(). UI work is in progress.

Notice about widgets
Widget list above is not complete and will be updated.

Illustrations

A group of illustrations for dialogs can be found in assets/images/dialogs/ folder:

  • General error
  • Network error
  • Registration success
  • Rainbows exchange success/shop
  • Thank you - challenge completed!

Constants

A list of constants that can be used for navigation and API, and perhaps to store some other values. Can be found in lib/constants folder.

AppRoute.routeName

Can be used to access a named route constant

Json serialization

We can use JSON serialization and generate the factory methods automatically by using json_serializable, build_runner and json_annotation packages.

Generate code
flutter pub run build_runner build

Generate code and update it automatically while working with model
flutter pub run build_runner serve --delete-conflicting-outputs

rainbow-challenge-front's People

Contributors

aparob avatar dependabot[bot] avatar don4t4s avatar karina-klinkeviciute avatar nitrat1311 avatar sangi762 avatar tyte avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

aparob gaoypchina

rainbow-challenge-front's Issues

creation of the "shop" to exchange rainbows to prizes

Rainbow shop

Rainbows (points) can be exchanged to prizes. For this we need a prize "shop" which is called "Rainbow shop".

In this screen User sees a list of prizes and also the amount of "active" rainbows that they can exchange into prizes.

List of prizes

We need to show a list of prizes. Each prize has this information:

  • name,
  • photo
  • description
  • price in rainbows
  • amount remaining.

Visually they should be scrollable to the sides or up (probably best to the sides).

Endpoint: https://rainbowchallenge.lt/api/schema/swagger-ui/#/api/api_results_available_prize_list

It should be scrolled (preferably horizontally but suggestions are welcome)

If a user decides to take one of those prizes, they can touch on it and get to the exchange window

Prize exchange

After User choses a prize in the prize list, they are brought to this screen.

endpoint for a prize:

https://rainbowchallenge.lt/api/schema/swagger-ui/#/api/api_results_available_prize_retrieve

Information to be displayed. :

* photo/illustration if there is one,
* name
* amount (available)
* price in rainbows

It has to have a field for the desired amount ("Pageidaujamas kiekis") of this prize and a button "Order" ("Užsakyti")

After pressing the button, a POST request has to be made to the endpoint for claimed prize https://rainbowchallenge.lt/api/schema/swagger-ui/#/api/api_results_claimed_prize_create.

On the backend, the availability of the prizes is being checked, together with the amount of rainbows. If there isn't enough of this prize available (let's say someone else took some a short moment ago), it will return an error. Also, if the user doesn't have enough of rainbow for this/these prizes, it will return an error too.

If there are no errors, a simple screen needs to be shown that says "Your request was sent, we will contact you by email and will let you know how you can receive it" ("Užsakymas išsiųstas. Susisieksim su tavim el. paštu ir pranešim, kaip atsiimti prizus.")

Then there's a "back" button which takes user to the list of prizes.

Please talk to Ieva @tyte about the designs

Add an option to upload files for the challenge.

Those files will be used as proofs of completing challenge, where needed.

Files should be uploaded to this endpoint: https://rainbowchallenge.lt/api/schema/swagger-ui/#/api/api_joined_challenge_file_upload_create

Together with the file we should send the UUID of the Joined Challenge for which this file is being attached. It's not the concrete (type)joined challenge, it's the uuid of main_joined_challenge.

Uploaded files should be displayed in the joined challenge page.

After being uploaded, the files can be reached in each of concrete challenge's main_challenge field files

Workflow of challenge "Custom"

Užduoties pradėjimas:

Sąraše paspaudus ant "Įvairios" tipo užduoties, atidaromas užduoties aprašymas. (endpoint: /api/challenge/custom_challenge/)
Priklausomai nuo to, ar užduotis jau pradėta, ir ar ją galima atlikti kelis kartus, prie užduoties aprašymo turi būti tokie pasirinkimai:

  1. Jei užduotis nebuvo dar pradėta (is_joined = false, can_be_joined = true):

Apačioje turi būti mygtukas "Pradėti užduotį".
Sukuriamas naujas article_joined_challenge objektas backende. Endpoint: /api/joined_challenge/custom_joined_challenge/ POST method, duomenys:

{
  "main_joined_challenge": {
    "challenge": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  }
}

Parodomas Pradėtos užduoties langas (žr. žemiau)

  1. Jei užduotis jau buvo pradėta ir ją galima atlikti tik vieną kartą (is_joined = true; can_be_joined = false)
    Apačioje turi būti mygtukas "Tęsti užduotį"

Challenge objekto duomenyse yra array concrete_joined_challenges. Šiuo atveju čia turėtų būti tik vienas article_joined_challenge, turėtume paimti jo uuid.

Šis uuid naudojamas paimant informaciją iš custom_joined_challenge endpoint:
GET /api/joined_challenge/custom_joined_challenge/{uuid}/

Parodomas Pradėtos užduoties langas (žr. žemiau)

  1. Jei užduotis jau pradėta ir ją galima atlikti kelis kartus (is_joined = true; can_be_joined = true):

Turėtų būti rodomas jau pradėtų užduočių sąrašas. Turėtų būti parašyta:
"Pasirinkite, kurią užduotį norite tęsti:"
Ir mygtukai:
"Pradėta: 2021-12-15"
"Pradėta: 2021-12-17"
Taip pat mygtukas "Pradėti naują".

Challenge objektų duomenyse yra array concrete_joined_challenges. Šiuo atveju čia gali būti keli custom_joined_challenge, iš jų reikia paimti pradėjimo datas.
Pasirinkus vieną pradėtą užduotį, pagal jos uuid parodomas šios Pradėtos užduoties langas (žr. žemiau)
Šis uuid naudojamas paimant informaciją iš custom_joined_challenge endpoint:
GET /api/joined_challenge/custom_joined_challenge/{uuid}/

Paspaudus mygtuką "Pradėti naują" vyktų scenarijus Nr. 1

  1. Jei užduotis jau atlikta ir ją galima buvo daryti tik vieną kartą (is_joined = false; can_be_joined = false):
    Parodomas užrašas "Šią užduotį jau atlikote."

Pradėtos užduoties langas:

Prie užduoties aprašymo (gal jį galima padaryti suskleidžiamą?) rodomas ir teksto laukas, viršuje kurio parašyta: "Aprašykite, kaip atlikote užduotį:". Vartotojas įveda aprašymą. Vartotojas gali pasirinkti arba atlikti užduotį iš karto, arba išsaugoti ir atlikti vėliau.
Tam turėtų būti mygtukai "Saugoti ir pateikti vėliau" ir "Pateikti".

Paspaudus "Saugoti ir pateikti vėliau" į endpoint custom_joined_challenge siunčiami tokie duomenys:

PATCH /api/joined_challenge/custom_joined_challenge/{uuid}/

{
  "main_joined_challenge": 
      "description": "Čia užduoties aprašymas"
}

Užduoties atlikimas

Įvedus aprašymą ir paspaudus mygtuką "Pateikti" į custom_joined_challenge endpoint siunčiamas užduoties aprašymas (description) ir status: completed:

PATCH /api/joined_challenge/custom_joined_challenge/{uuid}/

{
  "main_joined_challenge": {
    "status": "completed",
  },
  "description": "galutinis aprašymas"
}

Jei užduotis yra tokia, kuriai nereikia patvirtinimo (needs_confirmation = false), t.y. pasitvirtina automatiškai, tai grąžinamas statusas bus confirmed, o jei reikia - grąžinamas statusas bus completed (ir taps confirmed vėliau, kai užduotį patvirtins administratoriai).

{
  "main_joined_challenge": {
    "status": "confirmed",
    "challenge": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  },
  "description": "galutinis aprašymas"
}

Jei grąžinamas status yra confirmed, tai vartotojui turi būti parodomas pranešimas "Ačiū už atliktą užduotį. Jums vaivorykštės įskaičiuotos".
Jei grąžinamas status yra completed, tai vartotojui turi būti parodomas pranešimas "Ačiū už atliktą užduotį! Savanoris peržiūrės jūsų atsakymą ir įskaitys vaivorykštes. Apie tai būsite informuoti pranešimų skiltyje.".

Update a registration page

As a LGBT adtivist I want to register for the app so that I could have fun using it.

Acceptance criteria:

  1. In order to do that, I have to fill in those fields, all required:
  • region
  • gender
  • year of birth
  • email
  1. Region will be selectable from the list of regions: https://rainbowchallenge.lt/api/schema/swagger-ui/#/api/api_results_region_list

  2. Gender will be selectable from the list of genders: https://rainbowchallenge.lt/api/schema/swagger-ui/#/api/api_user_gender_retrieve

  3. Year of birth is in a 4 digits format

  4. email is in email format

Endpoint for this is this: https://rainbowchallenge.lt/api/schema/swagger-ui/#/auth/auth_users_create

it should also say "Informaciją renkame tik statistikos tikslais" (we are collecting information for statistics only)

Sukurti "renginio organizavimas" užduoties langą

Additional fields for joined challenge:

event_name = models.TextField
event_url = models.URLField

description = models.TextField
organized_alone = models.BooleanField

Event name and description should be required fields. OrganizedAlone should be presented as some sort of yes/no options, not as checlbox.

In the list of challenges, add indicators if a current user has joined/completed that challenge

CONSIDERATIONS:
As some challenges can be completed more than once, I am not sure how to visually implement this. Might be checkmark if completed, but also some other if there are ongoing ones?

There is a field can_be_joined on the challenge. Users can't join challenges which they already joined/completed that are marked as doable only once.

There is also is_joined which is true if the challenge is currently joined at least once (but not if completed).

If a challenge has been joined, but not completed (is_joined is true) it should have a green checkmark indicator next to it. It means it can be continued (completed).

If a challenge can't be joined or continued, it should be greyed out and unavailable for joining but should be still showing.

an optional pin for extra security

If user wants, they could set a PIN for accessing the app every time. This is for situations when there is a risk that user's friends or family might see it and that might cause disturbance if for example they are not LGBTQIA+ friendly.

Create a screen for the information aboout the region

(not sure if we do need this)

Info about region. Number of users in that region. Total number of completed tasks and received rainbows. Sum of current streaks of users in that region.

Maybe a list of changes by weeks - dynamic of streaks.

Create a challenge of type "quiz"

This will be a type of challenge where a user has to complete a quiz. Endpoint: https://rainbowchallenge.lt/api/schema/swagger-ui/#/api/api_challenge_quiz_challenge_list (not complete yet).

There will be some amount of questions (for example 10 or 15) and each question will have a few (e.g. 3 or 4) possible answers.

On joining quiz challenge a POST to this endpoint will be sent: https://rainbowchallenge.lt/api/schema/swagger-ui/#/api/api_joined_challenge_quiz_joined_challenge_create

Only one answer to each question is correct. After answering each question, the app will send the selected answer to an endpoint which will return if the answer was correct, and if not - which was. (endpoint not ready yet)

After finishing all questions, the state of the quiz should be set to "completed" and sent with the PATCH method to the quiz joined challenge endpoint (https://rainbowchallenge.lt/api/schema/swagger-ui/#/api/api_joined_challenge_quiz_joined_challenge_partial_update)

User profile settings page

As a user, I want to be able to get into the user settings so that I would be able to update them and change my profile if needed.

Acceptance criteria:

  • User can change their display name (username)
  • User can change their year of birth
  • User can change their gender
  • User can change their region
  • User can change their LGBTQIA+ status
  • Changed data would be saved to the backend

Sukurti regionų pirmumo lentelės langą

Regionai varžosi pagal "streaks" - nepertrauktukus (aktyvias savaites). Regiono aktyvių savaičių skaičius yra visų to regiono narių aktyvių savaičių suma.

Regionų lentelėje turėtų būti rodoma 10 regionų, išrikiuotų pagal daugiausiai aktyvių savaičių. Regionai, kurie neturi nei vienos aktyvios savaitės, neturi būti rodomi.

Iš endpointo bus gaunamas šis sąrašas, jį reikėtų parodyti. Pirmoje vietoje esantis regionas turėtų būti paryškintas labiausiai, bet taip pat reikėtų paryškinti ir antroje bei trečioje vietoje esančius regionus.

Create page "completed challenges"

there is an endpoint for that: /api/user/completed_challenges

completed challenges and confirmed challenges should be shown differently. For example, confirmed challenges could have bright rainbow next to them and completed but not yet confirmed - a dimmed or grayed out rainbow. (other similar suggestions of completed/confirmed indicators are welcome)

We need a new indicator in the "Navigacija" menu that says "Atliktos užduotys" for this

A screen for exchanging rainbows to prize

After User clicks on a prize in the prize list, they are brought to this screen.

endpoint for an prize:

https://rainbowchallenge.lt/api/schema/swagger-ui/#/api/api_results_available_prize_retrieve

Information to be displayed. :

  • photo/illustration if there is one,
  • name
  • amount (available)
  • price in rainbows

It has to have a field for the desired amount ("Pageidaujamas kiekis") of this prize and a button "Order" ("Užsakyti")

After pressing the button, a POST request has to be made to the endpoint for claimed prize (endpoint to be added yet).

On the backend, the availability of the prizes is being checked, together with the amount of rainbows. If there isn't enough of this prize available (let's say someone else took some a short moment ago), it will return an error. Also, if the user doesn't have enough of rainbow for this/these prizes, it will return an error too.

If there are no errors, a simple screen needs to be shown that says "Your request was sent, we will contact you by email and will let you know how you can receive it" ("Užsakymas išsiųstas. Susisieksim su tavim el. paštu ir pranešim, kaip atsiimti prizus.")

Then there's a "back" button which takes user to the list of prizes.

Create a screen where the user could check their own rainbows

User here should be able to see the amount of rainbows they collected and the list of tasks for which they got them.

They should also be able to see here, into which prizes they have exchanged their rainbows.

Endpoint: https://rainbowchallenge.lt/api/schema/swagger-ui/#/api/api_results_balance_retrieve

Data returned from endpoint:

{
"earned_rainbows": 25,
"remaining_rainbows": 20,
"earning": [
{
"name": "LGBT+ istorijos knygos pristatymas",
"points": 25
}
],
"spending": [
{
"name": "Vaivorykštės ženkliukas",
"amount": 1,
"price": 5,
"total": 5
}
]
}

Data layout should look like this:

image

Create challenge "Write an article"

Užduoties pradėjimas:

Sąraše paspaudus ant "Dalyvavimas renginyje" tipo užduoties, atidaromas užduoties aprašymas. (endpoint: /api/challenge/article_challenge/)
Priklausomai nuo to, ar užduotis jau pradėta, ir ar ją galima atlikti kelis kartus, prie užduoties aprašymo turi būti tokie pasirinkimai:

  1. Jei užduotis nebuvo dar pradėta (is_joined = false, can_be_joined = true):

Apačioje turi būti mygtukas "Pradėti užduotį".
Sukuriamas naujas article_joined_challenge objektas backende. Endpoint: /api/joined_challenge/article_joined_challenge/ POST method, duomenys:

{
  "main_joined_challenge": {
    "challenge": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  }
}

Parodomas Pradėtos užduoties langas (žr. žemiau)

  1. Jei užduotis jau buvo pradėta ir ją galima atlikti tik vieną kartą (is_joined = true; can_be_joined = false)
    Apačioje turi būti mygtukas "Tęsti užduotį"

Challenge objekto duomenyse yra array concrete_joined_challenges. Šiuo atveju čia turėtų būti tik vienas article_joined_challenge, turėtume paimti jo uuid.

Šis uuid naudojamas paimant informaciją iš article_joined_challenge endpoint:
GET /api/joined_challenge/article_joined_challenge/{uuid}/

Parodomas Pradėtos užduoties langas (žr. žemiau)

  1. Jei užduotis jau pradėta ir ją galima atlikti kelis kartus (is_joined = true; can_be_joined = true):

Turėtų būti rodomas jau pradėtų užduočių sąrašas. Turėtų būti parašyta:
"Pasirinkite, kurią užduotį norite tęsti:"
Ir mygtukai:
"Pradėta: 2021-12-15"
"Pradėta: 2021-12-17"
Taip pat mygtukas "Pradėti naują".

Challenge objektų duomenyse yra array concrete_joined_challenges. Šiuo atveju čia gali būti keli article_joined_challenge, iš jų reikia paimti pradėjimo datas.

Pasirinkus vieną pradėtą užduotį, pagal jos uuid parodomas šios Pradėtos užduoties langas (žr. žemiau)
Šis uuid naudojamas paimant informaciją iš article_joined_challenge endpoint:
GET /api/joined_challenge/article_joined_challenge/{uuid}/

Paspaudus mygtuką "Pradėti naują" vyktų scenarijus Nr. 1

  1. Jei užduotis jau atlikta ir ją galima buvo daryti tik vieną kartą (is_joined = false; can_be_joined = false):
    Parodomas užrašas "Šią užduotį jau atlikote."

Pradėtos užduoties langas:

Prie užduoties aprašymo (gal jį galima padaryti suskleidžiamą?) rodomi ir šie laukai:

  • teksto laukas, viršuje kurio parašyta: "Aprašykite, kaip atlikote užduotį:". Vartotojas įveda aprašymą.
  • Straipsnio pavadinimas
  • Straipsnio nuoroda

Vartotojas gali pasirinkti arba atlikti užduotį iš karto, arba išsaugoti ir atlikti vėliau.
Tam turėtų būti mygtukai "Saugoti ir pateikti vėliau" ir "Pateikti".

Paspaudus "Saugoti ir pateikti vėliau" į endpoint article_joined_challenge siunčiami tokie duomenys:

PATCH /api/joined_challenge/article_joined_challenge/{uuid}/

{
  "main_joined_challenge": 
      "description": "Čia užduoties aprašymas",
     "article_url": "someurl.com/article/1",
     "article_name": "Article Name"
}

Užduoties atlikimas

Įvedus aprašymą ir paspaudus mygtuką "Pateikti" į article_joined_challenge endpoint siunčiamas užduoties aprašymas (description) ir status: completed:

PATCH /api/joined_challenge/article_joined_challenge/{uuid}/

{
  "main_joined_challenge": {
    "status": "completed",
  },
  "description": "galutinis aprašymas",
   "article_url": "someurl.com/article/1",
   "article_name": "Article Name"
}

Jei užduotis yra tokia, kuriai nereikia patvirtinimo (needs_confirmation = false), t.y. pasitvirtina automatiškai, tai grąžinamas statusas bus confirmed, o jei reikia - grąžinamas statusas bus completed (ir taps confirmed vėliau, kai užduotį patvirtins administratoriai).

{
  "main_joined_challenge": {
    "status": "confirmed",
    "challenge": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  },
  "description": "galutinis aprašymas",
     "article_url": "someurl.com/article/1",
   "article_name": "Article Name"
}

Jei grąžinamas status yra confirmed, tai vartotojui turi būti parodomas pranešimas "Ačiū už atliktą užduotį. Jums vaivorykštės įskaičiuotos".
Jei grąžinamas status yra completed, tai vartotojui turi būti parodomas pranešimas "Ačiū už atliktą užduotį! Savanoris peržiūrės jūsų atsakymą ir įskaitys vaivorykštes. Apie tai būsite informuoti pranešimų skiltyje.".

Changing of User password

As a user, I want to go to my profile, from there go to the password changing page, enter new password so that I would be able to change the password.

Acceptance criteria:
User can change their password
Password is validated to be a safe password

Fix constants in endpoint urls.

Used in lib/utils/repository/challenges/CHALLENGE_TYPE.dart
Using a constant for whole endpoint creates wrong url using dio getItem(). Tested with Api.challengeEventParticipantEndpoint constant.

Constants seem to work with get, but not post.

create page "joined challenges"

Talk to me before starting (Karina)

there is an endpoint that returns all joined challenges for the user: /api/user/joined_challenges

Messages screen

Add messages screen. We need to show messages from the server.

We also need to show an indicator on the messages tab in the menu if there are new messages. For that we need to know which messages are new. For that we need to set all seen messages to "seen" (there is a property for that on the message model). So after the messages are downloaded to the messages tab, and ideally - scrolled to in the messages screen, for each of the messages that haven't been "seen" before, we need to send a patch request with "seen" set to true.

API endpoints: GET https://rainbowchallenge.lt/api/schema/swagger-ui/#/api/api_message_list and PATCH: https://rainbowchallenge.lt/api/schema/swagger-ui/#/api/api_message_partial_update

Stiliaus dizainas

Numatyti dizainą, taip pat numatyti, kaip dizaino elementai bus perduodami į atskirus langus. Sukurti dizaino struktūros "griaučius".

Sukurti užduoties "Dalyvavimas renginyje" eigą

Užduoties pradėjimas:

Sąraše paspaudus ant "Dalyvavimas renginyje" tipo užduoties, atidaromas užduoties aprašymas. (endpoint: /api/challenge/event_participant_challenge/)
Priklausomai nuo to, ar užduotis jau pradėta, ir ar ją galima atlikti kelis kartus, prie užduoties aprašymo turi būti tokie pasirinkimai:

  1. Jei užduotis nebuvo dar pradėta (is_joined = false, can_be_joined = true):

Apačioje turi būti mygtukas "Pradėti užduotį".
Sukuriamas naujas event_participant_joined_challenge objektas backende. Endpoint: /api/joined_challenge/event_participant_joined_challenge/ POST method, duomenys:

{
  "main_joined_challenge": {
    "challenge": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  }
}

Parodomas Pradėtos užduoties langas (žr. žemiau)

  1. Jei užduotis jau buvo pradėta ir ją galima atlikti tik vieną kartą (is_joined = true; can_be_joined = false)
    Apačioje turi būti mygtukas "Tęsti užduotį"

Challenge objekto duomenyse yra array concrete_joined_challenges. Šiuo atveju čia turėtų būti tik vienas event_participant_joined_challenge, turėtume paimti jo uuid ar duomenis (kaip patogiau padaryti frontende)

Šis uuid naudojamas paimant informaciją iš event_participant_joined_challenge endpoint:
GET /api/joined_challenge/event_participant_joined_challenge/{uuid}/

Parodomas Pradėtos užduoties langas (žr. žemiau)

  1. Jei užduotis jau pradėta ir ją galima atlikti kelis kartus (is_joined = true; can_be_joined = true):

Turėtų būti rodomas jau pradėtų užduočių sąrašas. Turėtų būti parašyta:
"Pasirinkite, kurią užduotį norite tęsti:"
Ir mygtukai:
"Pradėta: 2021-12-15"
"Pradėta: 2021-12-17"
Taip pat mygtukas "Pradėti naują".
Challenge objektų duomenyse yra array concrete_joined_challenges. Šiuo atveju čia gali būti keli event_participant_joined_challenge, iš jų reikia paimti pradėjimo datas.
Pasirinkus vieną pradėtą užduotį, pagal jos uuid parodomas šios Pradėtos užduoties langas (žr. žemiau)
Šis uuid naudojamas paimant informaciją iš event_participant_joined_challenge endpoint:
GET /api/joined_challenge/event_participant_joined_challenge/{uuid}/

Paspaudus mygtuką "Pradėti naują" vyktų scenarijus Nr. 1

  1. Jei užduotis jau atlikta ir ją galima buvo daryti tik vieną kartą (is_joined = false; can_be_joined = false):
    Parodomas užrašas "Šią užduotį jau atlikote."

Pradėtos užduoties langas:

(kaip dabar)

Užduoties atlikimas

Nuskenavus QR kodą, jo tekstas siunčiamas į event_participant_joined_challenge endpoint, taip pat siunčiamas statusas completed:

PATCH /api/joined_challenge/event_participant_joined_challenge/{uuid}/

{
  "main_joined_challenge": {
    "status": "completed",
  },
  "qr_code": "qr_kodo_tekstas"
}

Jei QR kodas sutampa su backend'e esamu, atsakymas iš backend turi būti toks (status: confirmed):

{
  "main_joined_challenge": {
    "status": "confirmed",
    "challenge": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  },
  "qr_code": "qr_kodo_tekstas"
}

Tokiu atveju vartotojui turi būti parodomas pranešimas "Ačiū už atliktą užduotį. Jums taškai įskaičiuoti".

Jei QR kodas neteisingas, iš backend grąžinama klaida:

{
  "qr_code": [
    "QR code is invalid."
  ]
} 

(čia bus išversta į lietuvių kalbą)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.