-
Notifications
You must be signed in to change notification settings - Fork 0
Zain/implement highlight UI v2 #42
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
zainbilalh
wants to merge
9
commits into
main
Choose a base branch
from
Zain/implement-highlight-ui-v2
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
9 commits
Select commit
Hold shift + click to select a range
296242d
refactored highlight logic into HighlightViewModel
zainbilalh 4f1fc2e
refactored HighlightViewModel
zainbilalh 34d2167
Added noHiglightView
zainbilalh 14ac665
passed HighlightViewModel as environment object
zainbilalh b5cecb1
attempt: make filter and search stick to top of screen
zainbilalh 600efc4
Added networking for articles
zainbilalh f26e312
Implemented networking for YouTubeVideos
zainbilalh 9d73e01
Changed fetch calls to be async
zainbilalh c5517a6
made all viewModel access patterns EnvironmentObject
zainbilalh 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| query Articles($sportsType: String) { | ||
| articles(sportsType: $sportsType) { | ||
| id | ||
| title | ||
| image | ||
| sportsType | ||
| publishedAt | ||
| url | ||
| } | ||
| } |
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,12 @@ | ||
| query YoutubeVideos { | ||
| youtubeVideos { | ||
| id | ||
| title | ||
| description | ||
| thumbnail | ||
| b64Thumbnail | ||
| url | ||
| publishedAt | ||
| duration | ||
| } | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,76 +37,14 @@ enum Highlight: Identifiable { | |
| return video.title | ||
| } | ||
| } | ||
|
|
||
| var sport: Sport{ | ||
|
Contributor
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. can we add a space between the "t" and "{" |
||
| switch self{ | ||
|
Contributor
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. same here space before the "{" |
||
| case .article(let article): | ||
| return article.sport | ||
| case .video(let video): | ||
| return video.sport | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // MARK: - Dummy Data | ||
| extension Highlight { | ||
| static let dummyData: [Highlight] = [ | ||
| .video( | ||
| YouTubeVideo( | ||
| id: "QGHb9heJAco", | ||
| title: "Cornell Celebrates Coach Mike Schafer '86", | ||
| description: "Cornell Celebrates Coach Mike Schafer '86 Narrated by Jeremy Schaap '91.", | ||
| thumbnail: "https://i.ytimg.com/vi/QGHb9heJAco/hqdefault.jpg", | ||
| b64Thumbnail: nil, | ||
| url: "https://youtube.com/watch?v=QGHb9heJAco", | ||
| publishedAt: "2025-10-014T00:00:00Z" | ||
| ) | ||
| ), | ||
| .article( | ||
| Article( | ||
| id: "1", | ||
| title: "Cornell Daily Sun Reports Historic Win", | ||
| summary: "Cornell's offense shines in a big win.", | ||
| image: "https://snworksceo.imgix.net/cds/2f1df221-010c-4a5b-94cc-ec7a100b7aa1.sized-1000x1000.jpg?w=1000&dpr=2", | ||
| url: "https://cornellsun.com/article", | ||
| source: "Cornell Daily Sun", | ||
| publishedAt: "2025-10-14T00:00:00Z" | ||
| ) | ||
| ), | ||
| .video( | ||
| YouTubeVideo( | ||
| id: "ABC123def", | ||
| title: "Cornell Basketball Highlights - Championship Game", | ||
| description: "Watch the best moments from Cornell's championship victory.", | ||
| thumbnail: "https://i.ytimg.com/vi/ABC123def/hqdefault.jpg", | ||
| b64Thumbnail: nil, | ||
| url: "https://youtube.com/watch?v=ABC123def", | ||
| publishedAt: "2025-10-013T00:00:00Z" | ||
| ) | ||
| ), | ||
| .article( | ||
| Article( | ||
| id: "2", | ||
| title: "Cornell Upsets Rival in Thrilling Overtime Victory", | ||
| summary: "Cornell's offense exploded late in the fourth quarter to secure a dramatic win.", | ||
| image: "https://snworksceo.imgix.net/cds/2f1df221-010c-4a5b-94cc-ec7a100b7aa1.sized-1000x1000.jpg?w=1000&dpr=2", | ||
| url: "https://cornellbigred.com/news/2025/10/08/article", | ||
| source: "Cornell Daily Sun", | ||
| publishedAt: "2025-10-14T00:00:00Z" | ||
| ) | ||
| ), | ||
| .video( | ||
| YouTubeVideo( | ||
| id: "XYZ789ghi", | ||
| title: "Cornell Hockey Rivalry Game Recap", | ||
| description: "Complete recap of the intense rivalry game between Cornell and their arch-rivals.", | ||
| thumbnail: "https://i.ytimg.com/vi/XYZ789ghi/hqdefault.jpg", | ||
| b64Thumbnail: nil, | ||
| url: "https://youtube.com/watch?v=XYZ789ghi", | ||
| publishedAt: "2025-10-14T00:00:00Z" | ||
| ) | ||
| ), | ||
| .article( | ||
| Article( | ||
| id: "3", | ||
| title: "Big Red Basketball Team Advances to Championship", | ||
| summary: "Cornell basketball team secures spot in the championship game with dominant performance.", | ||
| image: "https://snworksceo.imgix.net/cds/2f1df221-010c-4a5b-94cc-ec7a100b7aa1.sized-1000x1000.jpg?w=1000&dpr=2", | ||
| url: "https://cornellsun.com/basketball-championship", | ||
| source: "Cornell Daily Sun", | ||
| publishedAt: "2025-10-13T00:00:00Z" | ||
| ) | ||
| ) | ||
| ] | ||
| } | ||
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.
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.
Not sure if this will ever happen, but could we also put a fallback value for the title and url since the Article properties aren't optionals? An empty string would work as a default