1
0
forked from MeloNX/MeloNX

GameList layout cleanup and proper colors applied

This commit is contained in:
Daniil Vinogradov 2025-07-14 19:49:28 +02:00
parent 89ad9b6457
commit b9d598a459

View File

@ -238,7 +238,7 @@ struct GameLibraryView: View {
private var gameListView: some View {
ScrollView {
LazyVStack(spacing: 0) {
LazyVStack(alignment: .leading, spacing: 0) {
if !isSearching && !realRecentGames.isEmpty {
// Recent Games Section
VStack(alignment: .leading, spacing: 0) {
@ -278,42 +278,25 @@ struct GameLibraryView: View {
.foregroundColor(.primary)
.padding(.horizontal)
.padding(.top)
ForEach(filteredGames) { game in
GameListRow(
game: game,
startemu: $startemu,
games: games,
isViewingGameInfo: $isViewingGameInfo,
isSelectingGameUpdate: $isSelectingGameUpdate,
isSelectingGameDLC: $isSelectingGameDLC,
gameRequirements: $gameRequirements,
gameInfo: $gameInfo,
isShowingGameController: $gameController,
perGameSettings: $gamePerGameSettings
)
.padding(.horizontal)
.padding(.vertical, 8)
}
}
}
} else {
ForEach(filteredGames) { game in
GameListRow(
game: game,
startemu: $startemu,
games: games,
isViewingGameInfo: $isViewingGameInfo,
isSelectingGameUpdate: $isSelectingGameUpdate,
isSelectingGameDLC: $isSelectingGameDLC,
gameRequirements: $gameRequirements,
gameInfo: $gameInfo,
isShowingGameController: $gameController,
perGameSettings: $gamePerGameSettings
)
.padding(.horizontal)
.padding(.vertical, 8)
}
}
ForEach(filteredGames) { game in
GameListRow(
game: game,
startemu: $startemu,
games: games,
isViewingGameInfo: $isViewingGameInfo,
isSelectingGameUpdate: $isSelectingGameUpdate,
isSelectingGameDLC: $isSelectingGameDLC,
gameRequirements: $gameRequirements,
gameInfo: $gameInfo,
isShowingGameController: $gameController,
perGameSettings: $gamePerGameSettings
)
.padding(.horizontal)
.padding(.vertical, 8)
}
Spacer(minLength: 50)
@ -892,18 +875,8 @@ struct GameListRow: View {
Spacer()
if $settingsManager.config.wrappedValue.contains(where: { $0.key == game.titleId }) {
Image(systemName: "gearshape.circle")
.resizable()
.aspectRatio(contentMode: .fill)
.foregroundStyle(.blue)
.frame(width: 20, height: 20)
}
VStack(alignment: .leading) {
VStack(alignment: .trailing) {
// Compatibility badges
HStack {
if let gameReq = gameRequirements.first(where: { $0.game_id == game.titleId }) {
let totalMemory = ProcessInfo.processInfo.physicalMemory
@ -938,6 +911,15 @@ struct GameListRow: View {
}
}
HStack {
if $settingsManager.config.wrappedValue.contains(where: { $0.key == game.titleId }) {
Image(systemName: "gearshape.circle")
.resizable()
.aspectRatio(contentMode: .fill)
.foregroundStyle(.blue)
.frame(width: 20, height: 20)
}
// Play button
Image(systemName: "play.circle.fill")
.font(.title3)
@ -950,6 +932,42 @@ struct GameListRow: View {
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
.contentShape(Rectangle())
.swipeActions(edge: .trailing) {
Button(role: .destructive) {
gametoDelete = game
showGameDeleteConfirmation.toggle()
} label: {
Label("Delete", systemImage: "trash")
}
Button {
gameInfo = game
isViewingGameInfo.toggle()
} label: {
Label("Info", systemImage: "info.circle")
}
.tint(.blue)
}
.swipeActions(edge: .leading) {
Button {
startemu = game
} label: {
Label("Play", systemImage: "play.fill")
}
.tint(.green)
}
.confirmationDialog("Are you sure you want to delete this game?", isPresented: $showGameDeleteConfirmation) {
Button("Delete", role: .destructive) {
if let game = gametoDelete {
deleteGame(game: game)
}
}
Button("Cancel", role: .cancel) {}
} message: {
Text("Are you sure you want to delete \(gametoDelete?.titleName ?? "this game")?")
}
.listRowInsets(EdgeInsets())
.wow(colorScheme)
.contextMenu {
Section {
Button {
@ -1015,42 +1033,6 @@ struct GameListRow: View {
}
}
}
.swipeActions(edge: .trailing) {
Button(role: .destructive) {
gametoDelete = game
showGameDeleteConfirmation.toggle()
} label: {
Label("Delete", systemImage: "trash")
}
Button {
gameInfo = game
isViewingGameInfo.toggle()
} label: {
Label("Info", systemImage: "info.circle")
}
.tint(.blue)
}
.swipeActions(edge: .leading) {
Button {
startemu = game
} label: {
Label("Play", systemImage: "play.fill")
}
.tint(.green)
}
.confirmationDialog("Are you sure you want to delete this game?", isPresented: $showGameDeleteConfirmation) {
Button("Delete", role: .destructive) {
if let game = gametoDelete {
deleteGame(game: game)
}
}
Button("Cancel", role: .cancel) {}
} message: {
Text("Are you sure you want to delete \(gametoDelete?.titleName ?? "this game")?")
}
.listRowInsets(EdgeInsets())
.wow(colorScheme)
} else {
Button(action: {
startemu = game
@ -1302,7 +1284,7 @@ extension View {
self
.background(
RoundedRectangle(cornerRadius: 12)
.fill(colorScheme == .dark ? Color(.systemGray6) : Color(.systemGray6).opacity(0.5))
.fill(Color(uiColor: .secondarySystemGroupedBackground))
)
}
}