-
-
Notifications
You must be signed in to change notification settings - Fork 117
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
Feat/hearts 2024 announcement #1110
Open
itsalaidbacklife
wants to merge
7
commits into
main
Choose a base branch
from
feat/hearts-2024-announcement
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.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8621f92
feat(BaseParagraph): implement component
itsalaidbacklife eded447
feat(AnnouncementDialog): Allow for multiple text chunks and links
itsalaidbacklife 101e788
style(AnnouncementDialog): switch to dark variant
itsalaidbacklife 34ff6b6
style(BaseParagraph): set link styles
itsalaidbacklife b8d98b0
style(BaseParagraph): style link
itsalaidbacklife dc2a874
feat: open links in new tab
itsalaidbacklife 3612256
feat(AnnouncementDialog): add start and end times
itsalaidbacklife 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 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,42 @@ | ||
<template> | ||
<div> | ||
<h2 v-if="heading"> | ||
{{ t(heading) }} | ||
</h2> | ||
<p> | ||
<template v-for="(chunk, index) in paragraph" :key="`text-chunk-${index}`"> | ||
<!-- Remote Link --> | ||
<a | ||
v-if="chunk.url" | ||
:href="chunk.url" | ||
target="_blank" | ||
class="text-cyan-lighten-2 font-weight-bold text-decoration-none" | ||
> | ||
{{ t(chunk.text) }} | ||
</a> | ||
<!-- Plain text --> | ||
<template v-else> | ||
{{ t(chunk.text) }} | ||
</template> | ||
</template> | ||
</p> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import { useI18n } from 'vue-i18n'; | ||
|
||
defineProps({ | ||
heading: { | ||
type: String, | ||
default: '', | ||
}, | ||
paragraph: { | ||
type: Array, | ||
required: true, | ||
}, | ||
}); | ||
|
||
const { t } = useI18n(); | ||
|
||
</script> |
This file contains 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
14 changes: 10 additions & 4 deletions
14
src/routes/home/components/announcementDialog/data/announcementData.js
This file contains 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 |
---|---|---|
@@ -1,13 +1,19 @@ | ||
import { Card } from '../../../../../../tests/e2e/fixtures/cards'; | ||
|
||
export const announcementData = { | ||
id: 'opponentHandRevealed', | ||
id: 'hearts2024Announcement', | ||
activatorText: 'announcement.activatorText', | ||
title: 'announcement.title', | ||
imgSrc: './img/announcement/deck-exhausted.gif', | ||
displayCards: [], | ||
displayCards: [ Card.JACK_OF_HEARTS, Card.QUEEN_OF_HEARTS, Card.KING_OF_HEARTS, Card.ACE_OF_HEARTS ], | ||
startTime: '2025-01-04', | ||
endTime: '2025-01-15', | ||
announcementText: [ | ||
{ | ||
heading: 'announcement.heading', | ||
paragraph: 'announcement.paragraph', | ||
paragraph: [ | ||
{ text: 'announcement.paragraph' }, | ||
{ text: 'announcement.twitchLink', url: 'https://twitch.tv/cuttle_cards' } | ||
], | ||
}, | ||
], | ||
}; |
This file contains 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.
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.
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.
I tested this locally and it works, but I'm not sure how to test it. The weird thing is that this component is so coupled to the
announcementData.js
file without using props. For that reason, I'm unsure how to set up a test to force the announcement data to have different values. Maybe the trick is to expose it to the window or as a store?This might be a usecase for component testing, but I'm similarly unsure how to stub the annoucement data