Skip to content
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

MetaDetails: Highlight Last Used Stream #794

Open
wants to merge 10 commits into
base: development
Choose a base branch
from
13 changes: 6 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@sentry/browser": "8.42.0",
"@stremio/stremio-colors": "5.2.0",
"@stremio/stremio-core-web": "0.48.5",
"@stremio/stremio-icons": "5.4.1",
"@stremio/stremio-icons": "5.5.0",
"@stremio/stremio-video": "0.0.48",
"a-color-picker": "1.2.1",
"bowser": "2.11.0",
Expand Down
7 changes: 4 additions & 3 deletions src/routes/MetaDetails/StreamsList/Stream/Stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const { useRouteFocused } = require('stremio-router');
const StreamPlaceholder = require('./StreamPlaceholder');
const styles = require('./styles');

const Stream = ({ className, videoId, videoReleased, addonName, name, description, thumbnail, progress, deepLinks, ...props }) => {
const Stream = ({ className, videoId, videoReleased, addonName, name, description, thumbnail, progress, deepLinks, lastUsed, ...props }) => {
const profile = useProfile();
const toast = useToast();
const platform = usePlatform();
Expand Down Expand Up @@ -144,7 +144,7 @@ const Stream = ({ className, videoId, videoReleased, addonName, name, descriptio

const renderLabel = React.useMemo(() => function renderLabel({ className, children, ...props }) {
return (
<Button className={classnames(className, styles['stream-container'])} title={addonName} href={href} target={target} download={download} onClick={onClick} {...props}>
<Button className={classnames(className, styles['stream-container'], { [styles['last-used-stream']]: lastUsed })} title={addonName} href={href} target={target} download={download} onClick={onClick} {...props}>
<div className={styles['info-container']}>
{
typeof thumbnail === 'string' && thumbnail.length > 0 ?
Expand Down Expand Up @@ -242,7 +242,8 @@ Stream.propTypes = {
})
})
}),
onClick: PropTypes.func
lastUsed: PropTypes.bool,
onClick: PropTypes.func,
};

module.exports = Stream;
4 changes: 4 additions & 0 deletions src/routes/MetaDetails/StreamsList/Stream/styles.less
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
background-color: var(--overlay-color);
}

&.last-used-stream {
border: 2px solid var(--primary-accent-color);
}

&:hover, &:focus, &:global(.selected) {
.icon {
opacity: 1;
Expand Down
3 changes: 2 additions & 1 deletion src/routes/MetaDetails/StreamsList/StreamsList.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ const StreamsList = ({ className, video, ...props }) => {
progress={stream.progress}
deepLinks={stream.deepLinks}
onClick={stream.onClick}
lastUsed={stream.lastUsed}
/>
))}
{
Expand All @@ -193,7 +194,7 @@ const StreamsList = ({ className, video, ...props }) => {
StreamsList.propTypes = {
className: PropTypes.string,
streams: PropTypes.arrayOf(PropTypes.object).isRequired,
video: PropTypes.object
video: PropTypes.object,
};

module.exports = StreamsList;
6 changes: 5 additions & 1 deletion src/types/models/MetaDetails.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ type MetaItemMetaDetails = MetaItem & {
deepLinks: MetaItemDeepLinks,
};

type MetaItemStream = Stream & {
lastUsed: boolean,
};

type MetaDetails = {
metaExtensions: {
url: string,
Expand All @@ -21,7 +25,7 @@ type MetaDetails = {
} | null,
streams: {
addon: Addon,
content: Loadable<Stream[]>
content: Loadable<MetaItemStream[]>
}[],
title: string | null,
};
Loading