-
Notifications
You must be signed in to change notification settings - Fork 280
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #786 from Stremio/refactor/streaming-server-warning
Board: update the style of the streaming server warning
- Loading branch information
Showing
8 changed files
with
182 additions
and
149 deletions.
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
73 changes: 0 additions & 73 deletions
73
src/routes/Board/StreamingServerWarning/StreamingServerWarning.js
This file was deleted.
Oops, something went wrong.
61 changes: 61 additions & 0 deletions
61
src/routes/Board/StreamingServerWarning/StreamingServerWarning.less
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,61 @@ | ||
// Copyright (C) 2017-2024 Smart code 203358507 | ||
|
||
@import (reference) '~@stremio/stremio-colors/less/stremio-colors.less'; | ||
@import (reference) '~stremio/common/screen-sizes.less'; | ||
|
||
.warning-container { | ||
display: flex; | ||
flex-direction: row; | ||
align-items: center; | ||
padding: 1rem; | ||
background-color: @color-accent5-dark3; | ||
border-radius: 0.5rem; | ||
box-shadow: 0rem 0.25rem 1rem rgba(0, 0, 0, 0.48), 0rem 0.5rem 3rem rgba(0, 0, 0, 0.64); | ||
|
||
.warning-statement { | ||
flex: 1; | ||
font-size: 1.2rem; | ||
max-height: 2.4em; | ||
color: @color-surface-light5-90; | ||
} | ||
|
||
.actions { | ||
display: flex; | ||
gap: 1rem; | ||
|
||
.action { | ||
flex: none; | ||
padding: 0.5rem 1rem; | ||
color: @color-surface-light5-90; | ||
background-color: rgba(0, 0, 0, 0.24); | ||
border-radius: var(--border-radius); | ||
|
||
&:first-child { | ||
margin-left: 0; | ||
} | ||
|
||
.label { | ||
font-size: 1.2rem; | ||
color: @color-surface-light5-90; | ||
} | ||
|
||
&:hover { | ||
.label { | ||
text-decoration: underline; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
@media only screen and (max-width: @minimum) { | ||
.warning-container { | ||
flex-direction: column; | ||
text-align: center; | ||
padding: 1rem 0.5rem; | ||
|
||
.actions { | ||
justify-content: space-around; | ||
} | ||
} | ||
} |
101 changes: 101 additions & 0 deletions
101
src/routes/Board/StreamingServerWarning/StreamingServerWarning.tsx
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,101 @@ | ||
// Copyright (C) 2017-2024 Smart code 203358507 | ||
|
||
import React, { useCallback } from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import classnames from 'classnames'; | ||
import { useServices } from 'stremio/services'; | ||
import { Button } from 'stremio/components'; | ||
import useProfile from 'stremio/common/useProfile'; | ||
import { withCoreSuspender } from 'stremio/common/CoreSuspender'; | ||
import styles from './StreamingServerWarning.less'; | ||
|
||
type Props = { | ||
className?: string; | ||
}; | ||
|
||
const StreamingServerWarning = ({ className }: Props) => { | ||
const { t } = useTranslation(); | ||
const { core } = useServices(); | ||
const profile = useProfile(); | ||
|
||
const createDismissalDate = (months: number, years = 0): Date => { | ||
const dismissalDate = new Date(); | ||
|
||
if (months) { | ||
dismissalDate.setMonth(dismissalDate.getMonth() + months); | ||
} | ||
if (years) { | ||
dismissalDate.setFullYear(dismissalDate.getFullYear() + years); | ||
} | ||
|
||
return dismissalDate; | ||
}; | ||
|
||
const updateSettings = useCallback((streamingServerWarningDismissed: Date) => { | ||
core.transport.dispatch({ | ||
action: 'Ctx', | ||
args: { | ||
action: 'UpdateSettings', | ||
args: { | ||
...profile.settings, | ||
streamingServerWarningDismissed | ||
} | ||
} | ||
}); | ||
}, [profile.settings]); | ||
|
||
const onLater = useCallback(() => { | ||
updateSettings(createDismissalDate(1)); | ||
}, [updateSettings]); | ||
|
||
const onDismiss = useCallback(() => { | ||
updateSettings(createDismissalDate(0, 50)); | ||
}, [updateSettings]); | ||
|
||
return ( | ||
<div className={classnames(className, styles['warning-container'])}> | ||
<div className={styles['warning-statement']}> | ||
{t('SETTINGS_SERVER_UNAVAILABLE')} | ||
</div> | ||
<div className={styles['actions']}> | ||
<a | ||
href='https://www.stremio.com/download-service' | ||
target='_blank' | ||
rel='noreferrer' | ||
> | ||
<Button | ||
className={styles['action']} | ||
title={t('SERVICE_INSTALL')} | ||
tabIndex={-1} | ||
> | ||
<div className={styles['label']}> | ||
{t('SERVICE_INSTALL')} | ||
</div> | ||
</Button> | ||
</a> | ||
<Button | ||
className={styles['action']} | ||
title={t('WARNING_STREAMING_SERVER_LATER')} | ||
onClick={onLater} | ||
tabIndex={-1} | ||
> | ||
<div className={styles['label']}> | ||
{t('WARNING_STREAMING_SERVER_LATER')} | ||
</div> | ||
</Button> | ||
<Button | ||
className={styles['action']} | ||
title={t('DONT_SHOW_AGAIN')} | ||
onClick={onDismiss} | ||
tabIndex={-1} | ||
> | ||
<div className={styles['label']}> | ||
{t('DONT_SHOW_AGAIN')} | ||
</div> | ||
</Button> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default withCoreSuspender(StreamingServerWarning); |
This file was deleted.
Oops, something went wrong.
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,5 @@ | ||
// Copyright (C) 2017-2024 Smart code 203358507 | ||
|
||
import StreamingServerWarning from './StreamingServerWarning'; | ||
|
||
export default StreamingServerWarning; |
This file was deleted.
Oops, something went wrong.
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