forked from MeloNX/MeloNX
GameList layout cleanup and proper colors applied
This commit is contained in:
parent
89ad9b6457
commit
b9d598a459
@ -238,7 +238,7 @@ struct GameLibraryView: View {
|
|||||||
|
|
||||||
private var gameListView: some View {
|
private var gameListView: some View {
|
||||||
ScrollView {
|
ScrollView {
|
||||||
LazyVStack(spacing: 0) {
|
LazyVStack(alignment: .leading, spacing: 0) {
|
||||||
if !isSearching && !realRecentGames.isEmpty {
|
if !isSearching && !realRecentGames.isEmpty {
|
||||||
// Recent Games Section
|
// Recent Games Section
|
||||||
VStack(alignment: .leading, spacing: 0) {
|
VStack(alignment: .leading, spacing: 0) {
|
||||||
@ -278,42 +278,25 @@ struct GameLibraryView: View {
|
|||||||
.foregroundColor(.primary)
|
.foregroundColor(.primary)
|
||||||
.padding(.horizontal)
|
.padding(.horizontal)
|
||||||
.padding(.top)
|
.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(
|
ForEach(filteredGames) { game in
|
||||||
game: game,
|
GameListRow(
|
||||||
startemu: $startemu,
|
game: game,
|
||||||
games: games,
|
startemu: $startemu,
|
||||||
isViewingGameInfo: $isViewingGameInfo,
|
games: games,
|
||||||
isSelectingGameUpdate: $isSelectingGameUpdate,
|
isViewingGameInfo: $isViewingGameInfo,
|
||||||
isSelectingGameDLC: $isSelectingGameDLC,
|
isSelectingGameUpdate: $isSelectingGameUpdate,
|
||||||
gameRequirements: $gameRequirements,
|
isSelectingGameDLC: $isSelectingGameDLC,
|
||||||
gameInfo: $gameInfo,
|
gameRequirements: $gameRequirements,
|
||||||
isShowingGameController: $gameController,
|
gameInfo: $gameInfo,
|
||||||
perGameSettings: $gamePerGameSettings
|
isShowingGameController: $gameController,
|
||||||
)
|
perGameSettings: $gamePerGameSettings
|
||||||
.padding(.horizontal)
|
)
|
||||||
.padding(.vertical, 8)
|
.padding(.horizontal)
|
||||||
}
|
.padding(.vertical, 8)
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer(minLength: 50)
|
Spacer(minLength: 50)
|
||||||
@ -892,18 +875,8 @@ struct GameListRow: View {
|
|||||||
|
|
||||||
Spacer()
|
Spacer()
|
||||||
|
|
||||||
if $settingsManager.config.wrappedValue.contains(where: { $0.key == game.titleId }) {
|
VStack(alignment: .trailing) {
|
||||||
Image(systemName: "gearshape.circle")
|
|
||||||
.resizable()
|
|
||||||
.aspectRatio(contentMode: .fill)
|
|
||||||
.foregroundStyle(.blue)
|
|
||||||
.frame(width: 20, height: 20)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
VStack(alignment: .leading) {
|
|
||||||
// Compatibility badges
|
// Compatibility badges
|
||||||
HStack {
|
|
||||||
if let gameReq = gameRequirements.first(where: { $0.game_id == game.titleId }) {
|
if let gameReq = gameRequirements.first(where: { $0.game_id == game.titleId }) {
|
||||||
let totalMemory = ProcessInfo.processInfo.physicalMemory
|
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
|
// Play button
|
||||||
Image(systemName: "play.circle.fill")
|
Image(systemName: "play.circle.fill")
|
||||||
.font(.title3)
|
.font(.title3)
|
||||||
@ -950,6 +932,42 @@ struct GameListRow: View {
|
|||||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||||
}
|
}
|
||||||
.contentShape(Rectangle())
|
.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 {
|
.contextMenu {
|
||||||
Section {
|
Section {
|
||||||
Button {
|
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 {
|
} else {
|
||||||
Button(action: {
|
Button(action: {
|
||||||
startemu = game
|
startemu = game
|
||||||
@ -1302,7 +1284,7 @@ extension View {
|
|||||||
self
|
self
|
||||||
.background(
|
.background(
|
||||||
RoundedRectangle(cornerRadius: 12)
|
RoundedRectangle(cornerRadius: 12)
|
||||||
.fill(colorScheme == .dark ? Color(.systemGray6) : Color(.systemGray6).opacity(0.5))
|
.fill(Color(uiColor: .secondarySystemGroupedBackground))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user