Skip to content

Commit 6740455

Browse files
authored
[UI] Update download manager page (#911)
* refactor to tabs * refactor to css module * add background * fix tabs list margin * refactor to table * fix bg color, border, spacing for table * update font color for table * use hp icons for play, pause, stop * rm icons styling * fix icons * vert align middle for action buttons * move style to class for title * rm unneccessary <> * pretty
1 parent 17f8a2f commit 6740455

File tree

11 files changed

+183
-280
lines changed

11 files changed

+183
-280
lines changed

src/frontend/assets/pause-icon.svg

-72
This file was deleted.

src/frontend/assets/play-icon.svg

-4
This file was deleted.

src/frontend/screens/DownloadManager/DownloadManagerHeader/index.tsx

+7-7
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ export default function GameListHeader({ time }: Props) {
2020
}
2121

2222
return (
23-
<div className="gameListHeader">
24-
<span>{t('game.title', 'Game Title')}</span>
25-
<span>{getTimeLabel()}</span>
26-
<span>{t('download-manager.queue.type', 'Type')}</span>
27-
<span>{t('game.store', 'Store')}</span>
28-
<span>{t('wine.actions', 'Action')}</span>
29-
</div>
23+
<tr>
24+
<th>{t('game.title', 'Game Title')}</th>
25+
<th>{getTimeLabel()}</th>
26+
<th>{t('download-manager.queue.type', 'Type')}</th>
27+
<th>{t('game.store', 'Store')}</th>
28+
<th>{t('wine.actions', 'Action')}</th>
29+
</tr>
3030
)
3131
}

src/frontend/screens/DownloadManager/components/DownloadManagerItem/index.css

-81
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,3 @@
1-
.downloadManagerListItem > .icons {
2-
display: flex;
3-
flex-direction: row;
4-
justify-content: space-evenly;
5-
align-items: center;
6-
padding: 0 1rem;
7-
align-self: center;
8-
flex-wrap: wrap;
9-
}
10-
11-
.downloadManagerListItem > .icons > .material-icons.settings.folder {
12-
position: initial;
13-
}
14-
15-
.downloadManagerListItem > .icons > a > svg,
16-
.downloadManagerListItem > .icons > svg {
17-
width: min(calc(1vw + 9px), 36px);
18-
height: min(calc(1vw + 9px), 36px);
19-
min-width: 22px;
20-
min-height: 22px;
21-
margin-left: 12px;
22-
}
23-
24-
.downloadManagerListItem {
25-
display: grid;
26-
grid-template-columns: 2fr 1fr 1fr 1fr 10%;
27-
grid-template-areas: 'name store platform action';
28-
margin: 0 var(--space-sm-fixed);
29-
align-items: center;
30-
justify-items: baseline;
31-
position: relative;
32-
cursor: default;
33-
place-self: center;
34-
border-top: 1px solid var(--divider);
35-
padding: var(--space-md) 0;
36-
}
37-
38-
.downloadManagerListItem:hover {
39-
background-color: var(--background-hover);
40-
}
41-
421
.downloadManagerTitleList {
432
grid-area: name;
443
font-size: 1em;
@@ -66,42 +25,6 @@
6625
margin-right: var(--space-md-fixed);
6726
}
6827

69-
.downloadManagerListItem > a {
70-
grid-area: cover;
71-
max-width: 15vh;
72-
width: 100%;
73-
height: 100%;
74-
}
75-
76-
.downloadManagerListItem > .icons > button {
77-
margin-left: 0;
78-
padding-left: 4px;
79-
}
80-
81-
.downloadManagerListItem > .progress {
82-
z-index: 5;
83-
grid-area: cover;
84-
font-weight: 500;
85-
background: var(--background-gradient);
86-
padding: 2px 5px;
87-
border-radius: 4px;
88-
color: var(--success);
89-
position: relative;
90-
bottom: -38px;
91-
left: -38px;
92-
color: var(--success);
93-
font-family: var(--actions-font-family);
94-
font-style: italic;
95-
font-weight: normal;
96-
line-height: 12px;
97-
}
98-
99-
.downloadManagerListItem > .progress > .MuiSvgIcon-root {
100-
position: relative;
101-
bottom: 0;
102-
top: 0;
103-
}
104-
10528
.react-contextmenu--visible {
10629
background-color: var(--background);
10730
padding: 14px 22px;
@@ -127,10 +50,6 @@
12750
cursor: initial;
12851
}
12952

130-
.downloadManagerListItem span:nth-child(3) {
131-
text-transform: capitalize;
132-
}
133-
13453
.downloadManagerTitleList > img {
13554
aspect-ratio: 16/9;
13655
object-fit: cover;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
.playIcon {
2+
fill: var(--color-success-200);
3+
}
4+
5+
.pauseIcon {
6+
fill: var(--color-tertiary-600);
7+
}
8+
9+
.downloadIcon {
10+
fill: var(--color-tertiary-600);
11+
}
12+
13+
.iconContainer {
14+
display: flex;
15+
justify-content: center;
16+
gap: var(--space-md-fixed);
17+
18+
> button {
19+
display: inline-flex;
20+
}
21+
}

src/frontend/screens/DownloadManager/components/DownloadManagerItem/index.tsx

+29-28
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
GameInfo,
99
HyperPlayInstallInfo
1010
} from 'common/types'
11-
import { ReactComponent as StopIcon } from 'frontend/assets/stop-icon.svg'
1211
import { CachedImage, SvgButton } from 'frontend/components/UI'
1312
import {
1413
getGameInfo,
@@ -19,15 +18,15 @@ import {
1918
import { useTranslation } from 'react-i18next'
2019
import { hasProgress } from 'frontend/hooks/hasProgress'
2120
import { useNavigate } from 'react-router-dom'
22-
import { ReactComponent as PlayIcon } from 'frontend/assets/play-icon.svg'
23-
import { ReactComponent as DownIcon } from 'frontend/assets/down-icon.svg'
24-
import { ReactComponent as PauseIcon } from 'frontend/assets/pause-icon.svg'
2521
import { GogInstallInfo } from 'common/types/gog'
2622
import { LegendaryInstallInfo } from 'common/types/legendary'
2723
import StopInstallationModal from 'frontend/components/UI/StopInstallationModal'
2824
import { observer } from 'mobx-react-lite'
2925
import libraryState from 'frontend/state/libraryState'
3026
import { hasStatus } from 'frontend/hooks/hasStatus'
27+
import { Images } from '@hyperplay/ui'
28+
import styles from './index.module.scss'
29+
const { PauseIcon, PlayIcon, XCircle, DownloadIcon } = Images
3130

3231
type Props = {
3332
element?: DMQueueElement
@@ -165,21 +164,21 @@ const DownloadManagerItem = observer(({ element, current, state }: Props) => {
165164
if (is_dlc) {
166165
return <>-</>
167166
}
168-
return <PlayIcon className="playIcon" />
167+
return <PlayIcon className={styles.playIcon} />
169168
}
170169

171170
if (canceled) {
172-
return <DownIcon />
171+
return <DownloadIcon className={styles.downloadIcon} />
173172
}
174173

175-
return <StopIcon />
174+
return <XCircle />
176175
}
177176

178177
const secondaryActionIcon = () => {
179178
if (state === 'paused') {
180-
return <PlayIcon className="playIcon" />
179+
return <PlayIcon className={styles.playIcon} />
181180
} else if (state === 'running') {
182-
return <PauseIcon className="pauseIcon" />
181+
return <PauseIcon className={styles.pauseIcon} />
183182
}
184183

185184
return <></>
@@ -257,8 +256,8 @@ const DownloadManagerItem = observer(({ element, current, state }: Props) => {
257256
progress={progress}
258257
/>
259258
) : null}
260-
<div className="downloadManagerListItem">
261-
<span
259+
<tr>
260+
<td
262261
role="button"
263262
onClick={() => goToGamePage()}
264263
className="downloadManagerTitleList"
@@ -277,24 +276,26 @@ const DownloadManagerItem = observer(({ element, current, state }: Props) => {
277276
{canceled ? ` (${t('queue.label.canceled', 'Canceled')})` : ''}
278277
</span>
279278
</span>
280-
</span>
281-
<span title={fullDate}>{hour}</span>
282-
<span>{translatedTypes[type]}</span>
283-
<span>{getStoreName(runner, t2('Other'))}</span>
284-
<span className="icons">
285-
<SvgButton onClick={handleMainActionClick} title={mainIconTitle()}>
286-
{mainActionIcon()}
287-
</SvgButton>
288-
{current && !isExtracting && (
289-
<SvgButton
290-
onClick={handleSecondaryActionClick}
291-
title={secondaryIconTitle()}
292-
>
293-
{secondaryActionIcon()}
279+
</td>
280+
<td title={fullDate}>{hour}</td>
281+
<td>{translatedTypes[type]}</td>
282+
<td>{getStoreName(runner, t2('Other'))}</td>
283+
<td>
284+
<div className={styles.iconContainer}>
285+
<SvgButton onClick={handleMainActionClick} title={mainIconTitle()}>
286+
{mainActionIcon()}
294287
</SvgButton>
295-
)}
296-
</span>
297-
</div>
288+
{current && !isExtracting && (
289+
<SvgButton
290+
onClick={handleSecondaryActionClick}
291+
title={secondaryIconTitle()}
292+
>
293+
{secondaryActionIcon()}
294+
</SvgButton>
295+
)}
296+
</div>
297+
</td>
298+
</tr>
298299
</>
299300
)
300301
})
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
.dmItemList {
2+
background-color: var(--color-neutral-800);
3+
border-radius: var(--space-sm-fixed);
4+
margin: var(--space-3xs) 0px;
5+
width: 100%;
6+
text-align: center;
7+
vertical-align: middle;
8+
-webkit-border-vertical-spacing: 0px;
9+
-webkit-border-horizontal-spacing: 0px;
10+
11+
tr:first-child {
12+
background-color: var(--color-neutral-700);
13+
th {
14+
padding: var(--space-sm-fixed) 0px;
15+
color: var(--color-neutral-400);
16+
17+
&:first-child {
18+
border-top-left-radius: var(--space-sm-fixed);
19+
}
20+
21+
&:last-child {
22+
border-top-right-radius: var(--space-sm-fixed);
23+
}
24+
}
25+
}
26+
27+
tr > td {
28+
padding: var(--space-sm-fixed) var(--space-2lg-fixed);
29+
color: var(--color-neutral-200);
30+
vertical-align: middle;
31+
}
32+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import React from 'react'
2+
import DownloadManagerHeader from '../../DownloadManagerHeader'
3+
import DownloadManagerItem from '../DownloadManagerItem'
4+
import { DMQueueElement, DownloadManagerState } from 'common/types'
5+
import styles from './index.module.scss'
6+
7+
export interface DownloadTableProps {
8+
elements: DMQueueElement[]
9+
time: 'started' | 'finished' | 'queued'
10+
isCurrent?: boolean
11+
state?: DownloadManagerState
12+
}
13+
14+
export function DownloadTable({
15+
elements,
16+
time,
17+
isCurrent,
18+
state
19+
}: DownloadTableProps) {
20+
return (
21+
<table className={styles.dmItemList}>
22+
<DownloadManagerHeader time={time} />
23+
{elements.map((el, key) => (
24+
<DownloadManagerItem
25+
key={key}
26+
element={el}
27+
current={!!isCurrent}
28+
state={state}
29+
/>
30+
))}
31+
</table>
32+
)
33+
}

0 commit comments

Comments
 (0)