-
Notifications
You must be signed in to change notification settings - Fork 15
feat: Alert popup when a round is already active/paused #303
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -35,7 +35,7 @@ | |||||||||
<cdx-button | ||||||||||
v-if="!showAddRoundForm" | ||||||||||
action="progressive" | ||||||||||
@click="addRound" | ||||||||||
@click="campaignRounds.some(r => r.status == 'active' || r.status=='paused') ? (ActiveGoalAlert = true) : addRound()" | ||||||||||
:disabled="campaign.isArchived" | ||||||||||
icon | ||||||||||
class="add-round-button" | ||||||||||
|
@@ -141,11 +141,23 @@ | |||||||||
/> | ||||||||||
</cdx-field> | ||||||||||
</div> | ||||||||||
|
||||||||||
</div> | ||||||||||
<cdx-dialog | ||||||||||
v-model:open="ActiveGoalAlert" | ||||||||||
title="Round already active" | ||||||||||
:primary-action="primaryAction" | ||||||||||
@primary="ActiveGoalAlert=false" | ||||||||||
> | ||||||||||
<p> | ||||||||||
You already have an active round in this campaign. Please complete or close the current round before starting a new one. | ||||||||||
</p> | ||||||||||
</cdx-dialog> | ||||||||||
|
||||||||||
</template> | ||||||||||
|
||||||||||
<script setup> | ||||||||||
import { ref, onMounted } from 'vue' | ||||||||||
import { ref, onMounted, defineComponent } from 'vue' | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||||||
import { useRoute, useRouter } from 'vue-router' | ||||||||||
import { useI18n } from 'vue-i18n' | ||||||||||
import { formatDate } from '@/utils' | ||||||||||
|
@@ -158,7 +170,7 @@ import { z } from 'zod' | |||||||||
import RoundView from '@/components/Round/RoundView.vue' | ||||||||||
import RoundNew from '@/components/Round/RoundNew.vue' | ||||||||||
import UserList from '@/components/UserList.vue' | ||||||||||
import { CdxButton, CdxTextInput, CdxField } from '@wikimedia/codex' | ||||||||||
import { CdxButton, CdxTextInput, CdxField, CdxDialog } from '@wikimedia/codex' | ||||||||||
|
||||||||||
// Icons | ||||||||||
import CogIcon from 'vue-material-design-icons/Cog.vue' | ||||||||||
|
@@ -178,6 +190,7 @@ const campaignId = route.params.id.split('-')[0] | |||||||||
const campaignEditMode = ref(false) | ||||||||||
const showAddRoundForm = ref(false) | ||||||||||
const canCloseCampaign = ref(false) | ||||||||||
const ActiveGoalAlert = ref(false) | ||||||||||
|
||||||||||
const campaign = ref({}) | ||||||||||
const campaignRounds = ref([]) | ||||||||||
|
@@ -199,6 +212,11 @@ const errors = ref({ | |||||||||
coordinators: '' | ||||||||||
}) | ||||||||||
|
||||||||||
const primaryAction = { | ||||||||||
label: 'Okay', | ||||||||||
actionType: 'progressive' | ||||||||||
Comment on lines
+216
to
+217
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||||||
}; | ||||||||||
|
||||||||||
const schema = z.object({ | ||||||||||
name: z.string().min(1, $t('montage-required-campaign-name')), | ||||||||||
openDate: z.string().refine((val) => !isNaN(Date.parse(val)), $t('montage-required-open-date')), | ||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The inline conditional logic in the click handler is complex and hard to read. Consider extracting this logic into a separate method like
handleAddRoundClick()
for better maintainability.Copilot uses AI. Check for mistakes.