-
Notifications
You must be signed in to change notification settings - Fork 27
issue/3349/follow-all-tournament-questions #4494
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
Open
lsabor
wants to merge
6
commits into
main
Choose a base branch
from
issue/3349/follow-all-tournament-questions
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+576
−41
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
1d8cac5
issue/3349/follow-all-tournament-questions
lsabor 28a51a5
front end implementation
lsabor 08e7428
formatting
lsabor bef3229
translations
lsabor 04e002e
Merge branch 'main' of github.com:Metaculus/metaculus into issue/3349…
lsabor 10708d8
address comments
lsabor File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
front_end/src/app/(main)/(tournaments)/tournament/components/tournament_subscribe_modal.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| "use client"; | ||
|
|
||
| import { useTranslations } from "next-intl"; | ||
| import { FC, useEffect, useState } from "react"; | ||
|
|
||
| import BaseModal from "@/components/base_modal"; | ||
| import Button from "@/components/ui/button"; | ||
| import Checkbox from "@/components/ui/checkbox"; | ||
|
|
||
| type Props = { | ||
| isOpen: boolean; | ||
| onClose: () => void; | ||
| mode: "follow" | "unfollow"; | ||
| defaultFollowQuestions?: boolean; | ||
| onSubmit: (followQuestions: boolean) => void; | ||
| isLoading: boolean; | ||
| }; | ||
|
|
||
| const TournamentSubscribeModal: FC<Props> = ({ | ||
| isOpen, | ||
| onClose, | ||
| mode, | ||
| defaultFollowQuestions = false, | ||
| onSubmit, | ||
| isLoading, | ||
| }) => { | ||
| const t = useTranslations(); | ||
| const [followQuestions, setFollowQuestions] = useState( | ||
| defaultFollowQuestions | ||
| ); | ||
lsabor marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| useEffect(() => { | ||
| setFollowQuestions(defaultFollowQuestions); | ||
| }, [defaultFollowQuestions]); | ||
|
|
||
| const isFollow = mode === "follow"; | ||
|
|
||
| return ( | ||
| <BaseModal | ||
| isOpen={isOpen} | ||
| onClose={() => onClose()} | ||
| label={ | ||
| isFollow | ||
| ? t("tournamentFollowModalTitle") | ||
| : t("tournamentUnfollowModalTitle") | ||
| } | ||
| className="max-w-sm" | ||
| > | ||
| <p className="my-3 text-gray-700 dark:text-gray-700-dark"> | ||
| {isFollow | ||
| ? t("tournamentFollowModalDescription") | ||
| : t("tournamentUnfollowModalDescription")} | ||
| </p> | ||
|
|
||
| <div className="my-4"> | ||
| <Checkbox | ||
| checked={followQuestions} | ||
| onChange={setFollowQuestions} | ||
| label={ | ||
| isFollow | ||
| ? t("tournamentFollowModalAlsoFollowQuestions") | ||
| : t("tournamentUnfollowModalAlsoUnfollowQuestions") | ||
| } | ||
| /> | ||
| <p className="ml-7 mt-1 text-xs text-gray-500 dark:text-gray-500-dark"> | ||
| {isFollow | ||
| ? t("tournamentFollowModalAlsoFollowQuestionsDescription") | ||
| : t("tournamentUnfollowModalAlsoUnfollowQuestionsDescription")} | ||
| </p> | ||
| </div> | ||
|
|
||
| <div className="flex justify-end gap-3"> | ||
| <Button variant="tertiary" onClick={onClose} disabled={isLoading}> | ||
| {t("cancel")} | ||
| </Button> | ||
| <Button | ||
| variant="primary" | ||
| onClick={() => onSubmit(followQuestions)} | ||
| disabled={isLoading} | ||
| > | ||
| {isFollow | ||
| ? t("tournamentFollowModalSubmit") | ||
| : t("tournamentUnfollowModalSubmit")} | ||
| </Button> | ||
| </div> | ||
| </BaseModal> | ||
| ); | ||
| }; | ||
|
|
||
| export default TournamentSubscribeModal; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
projects/migrations/0022_projectsubscription_follow_questions.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # Generated by Django 5.1.9 | ||
|
|
||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| ("projects", "0021_projectindex_project_index_projectindexpost"), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AddField( | ||
| model_name="projectsubscription", | ||
| name="follow_questions", | ||
| field=models.BooleanField(default=False), | ||
| ), | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.