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

[UX] Divide Wine-GE and Wine-GE-LoL in 2 tabs #3327

Merged
merged 2 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>
</>
)
})
}