Skip to content

Commit

Permalink
[UX] Divide Wine-GE and Wine-GE-LoL in 2 tabs (#3327)
Browse files Browse the repository at this point in the history
Divide Wine-GE and Wine-GE-LoL in 2 tabs
  • Loading branch information
arielj authored Dec 19, 2023
1 parent 9e9ffcc commit ced0c3a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,7 @@ export interface WikiInfo {
*/
export type Type =
| 'Wine-GE'
| 'Wine-GE-LoL'
| 'Proton-GE'
| 'Proton'
| 'Wine-Lutris'
Expand Down
19 changes: 15 additions & 4 deletions src/frontend/screens/WineManager/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const configStore = new TypeCheckedStoreFrontend('wineManagerConfigStore', {
cwd: 'store'
})

export default React.memo(function WineManager(): JSX.Element | null {
export default function WineManager(): JSX.Element | null {
const { t } = useTranslation()
const { refreshWineVersionInfo, refreshing, platform } =
useContext(ContextProvider)
Expand All @@ -46,14 +46,25 @@ export default React.memo(function WineManager(): JSX.Element | null {
WineManagerUISettings[]
>([
{ type: 'Wine-GE', value: 'winege', enabled: isLinux },
{ type: 'Wine-GE-LoL', value: 'winege-lol', enabled: isLinux },
{ type: 'Proton-GE', value: 'protonge', enabled: isLinux },
{ type: 'Wine-Crossover', value: 'winecrossover', enabled: !isLinux },
{ type: 'Wine-Staging-macOS', value: 'winestagingmacos', enabled: !isLinux }
])

const getWineVersions = (repo: Type) => {
const versions = wineDownloaderInfoStore.get('wine-releases', [])
return versions.filter((version) => version.type === repo)
let versions = wineDownloaderInfoStore.get('wine-releases', [])

if (repo.startsWith('Wine-GE')) {
versions = versions.filter((version) => version.type === 'Wine-GE')
if (repo.endsWith('LoL')) {
return versions.filter((version) => version.version.endsWith('LoL'))
} else {
return versions.filter((version) => !version.version.endsWith('LoL'))
}
} else {
return versions.filter((version) => version.type === repo)
}
}

const [wineVersions, setWineVersions] = useState<WineVersionInfo[]>(
Expand Down Expand Up @@ -155,4 +166,4 @@ export default React.memo(function WineManager(): JSX.Element | null {
</div>
</>
)
})
}

0 comments on commit ced0c3a

Please sign in to comment.