diff --git a/README.md b/README.md index 21e8923..e1ce08a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # top90-frontend -Top90 is a website that populates with soccer goals in real time as they happen around the world +top90 is a website that populates with soccer goals in real time as they happen around the world https://top90.io diff --git a/src/components/Video.tsx b/src/components/Video.tsx index 6e9d69b..2ddcdc7 100644 --- a/src/components/Video.tsx +++ b/src/components/Video.tsx @@ -1,7 +1,8 @@ -import {Goal} from '../api/goals'; -import {API_BASE_URL} from '../api/core'; +import {Goal} from '../lib/api/goals'; +import {API_BASE_URL} from '../lib/api/core'; import {useEffect, useState} from 'react'; +import {cloudfrontEnabled} from '../lib/utils'; const buttonStyle = { border: 'none', @@ -70,19 +71,29 @@ export function Video({goal}: {goal: Goal}) { return 'https://s3-redditsoccergoals.top90.io/' + s3Key; } + function thumbnailUrl(goal: Goal) { + if (cloudfrontEnabled()) { + return cloudfrontUrl(goal.ThumbnailS3Key); + } + + return goal.ThumbnailPresignedUrl; + } + + function videoUrl(goal: Goal) { + if (cloudfrontEnabled()) { + return cloudfrontUrl(goal.S3ObjectKey); + } + + return goal.PresignedUrl; + } + return (
{goal.RedditPostTitle}
-