Skip to content

Commit

Permalink
Add live link to ongoing match
Browse files Browse the repository at this point in the history
  • Loading branch information
acupoftee committed Apr 17, 2020
1 parent 85265fc commit cfa50d2
Showing 1 changed file with 34 additions and 17 deletions.
51 changes: 34 additions & 17 deletions src/renderer/components/Schedule/EventCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { Link } from 'react-router-dom'
import Banner from './Banner'
import MatchCard from './MatchCard'

const electron = window.require('electron')

const Wrapper = styled.div`
width: 100%;
height: auto;
Expand Down Expand Up @@ -48,23 +50,38 @@ const EventCard = ({
start={match.startDate}
/>
)
return match.status === 'PENDING' ? (
<Link
key={idx}
to={{
pathname: `/preview/${match.id}`,
state: {
matchLocation: `${bannerProps.location}`,
},
}}
>
{content}
</Link>
) : (
<Link key={idx} to={`/match/${match.id}`}>
{content}
</Link>
)
if (match.status === 'ONGOING') {
return (
<div
onClick={() => {
electron.remote.app.hide()
electron.shell.openExternal(
'https://www.youtube.com/overwatchleague'
)
}}
>
{content}
</div>
)
} else {
return match.status === 'PENDING' ? (
<Link
key={idx}
to={{
pathname: `/preview/${match.id}`,
state: {
matchLocation: `${bannerProps.location}`,
},
}}
>
{content}
</Link>
) : (
<Link key={idx} to={`/match/${match.id}`}>
{content}
</Link>
)
}
})}
</>
</Wrapper>
Expand Down

0 comments on commit cfa50d2

Please sign in to comment.