-
Notifications
You must be signed in to change notification settings - Fork 2
Announcement Preview and Link Button #1139
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
Merged
SierraTran
merged 17 commits into
main
from
SierraTran/announcement-preview-and-link-button
Nov 11, 2025
Merged
Changes from 14 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
aa5c857
Add linkText and linkUrl to annoucements schema
SierraTran 976ba51
Add linkText and linkUrl to createAnnouncement and updateAnnouncement…
SierraTran d28fc9d
Add linkText and linkUrl to createAnnouncement and updateAnnouncement…
SierraTran 04d3b82
Add the announcement card as a preview and fields for link button tex…
SierraTran 7f4f135
Add link button in card actions if the announcement has one
SierraTran 4bd0a4b
Migration for new linkText and linkUrl columns in Announcements table
SierraTran c4ed1af
Add new hasLInk column to announcements table and mutations
SierraTran e688a0b
Add link columns to announcement queries
SierraTran af71e7b
Utilize hasLInk column for displaying the link button
SierraTran feb0cc1
Add link columns to variables for mutation
SierraTran 7110fe5
Enhance announcement forms with link functionality and validation
SierraTran 586c68b
Merge branch 'main' into SierraTran/announcement-preview-and-link-button
SierraTran 01b86fd
Merge branch 'main' into SierraTran/announcement-preview-and-link-button
SierraTran adcd6ce
Remove hasLink column and use local boolean instead
SierraTran 64e5ce4
Add useEffect to set showLinkFields accurately
SierraTran a3bea2f
Merge branch 'main' into SierraTran/announcement-preview-and-link-button
SierraTran 218de7e
Merge branch 'main' into SierraTran/announcement-preview-and-link-button
SierraTran 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,37 @@ | ||
| import { Card, CardContent, Typography, useTheme } from "@mui/material"; | ||
| import { Button, Card, CardActions, CardContent, Typography, useTheme } from "@mui/material"; | ||
| import { Announcement } from "../../../queries/announcementsQueries"; | ||
| import ThemedMarkdown from "../../../common/ThemedMarkdown"; | ||
|
|
||
| interface AnnouncementCardProps { | ||
| announcement: Announcement; | ||
| announcement: Announcement; | ||
| } | ||
|
|
||
| export default function AnnouncementCard(props: AnnouncementCardProps) { | ||
| const theme = useTheme(); | ||
| return ( | ||
| <Card sx={{ height: "100%" }}> | ||
| <CardContent> | ||
| <Typography color={theme.palette.primary.main} variant="h5">{props.announcement.title}</Typography> | ||
| <Typography variant="body1"><ThemedMarkdown>{props.announcement.description}</ThemedMarkdown></Typography> | ||
| </CardContent> | ||
| </Card> | ||
| ); | ||
| } | ||
| const theme = useTheme(); | ||
| return ( | ||
| <Card sx={{ height: "100%" }}> | ||
| <CardContent> | ||
| <Typography color={theme.palette.primary.main} variant="h5"> | ||
| {props.announcement.title} | ||
| </Typography> | ||
| <Typography variant="body1"> | ||
| <ThemedMarkdown>{props.announcement.description}</ThemedMarkdown> | ||
| </Typography> | ||
| </CardContent> | ||
| <CardActions sx={{ justifyContent: 'flex-end' }}> | ||
| {props.announcement.linkUrl ? ( | ||
| <Button | ||
| variant="contained" | ||
| color="info" | ||
| size="small" | ||
| href={props.announcement.linkUrl} | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| > | ||
| {props.announcement.linkText} | ||
| </Button> | ||
| ) : null} | ||
| </CardActions> | ||
| </Card> | ||
| ); | ||
| } |
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
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.
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.
When testing this, it seems like the default value of this isnt getting calculated just right. If i add a link and link text to an announcement, then save and close it, then reopen it, the Link Button switch is set to off. If i turn it on manually it shows the saved fields just fine though
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 recently pushed a commit (64e5ce4) to remedy this. The
useEffectlooks clunky to me but I could be overthinking it.