change List view UI disposition

This commit is contained in:
Giovanni committed 2026-09-05 14:17:40 +02:00
1 parent 33c9937547
commit d12292e6af
6 files changed
+48 -8

No files matched your search

@@ -7,7 +7,7 @@
import SwiftUI
struct CreateWorldButtonView : View {
struct CreateWorldButton : View {
var body: some View {
NavigationLink{
CreateWorldView()
@@ -7,7 +7,7 @@
import SwiftUI
struct WorldCardView : View {
struct WorldCard : View {
var world : World
var isSelected = false
+1 -1
View File
@@ -9,6 +9,6 @@ import SwiftUI
struct HomeView : View {
var body: some View {
CreateWorldButtonView()
CreateWorldButton()
}
}
@@ -0,0 +1,40 @@
//
// EmptyWorldView.swift
// WorldBuilder
//
// Created by Giovanni Josserand on 02/09/2026.
//
import SwiftUI
struct EmptyWorld : View {
var body : some View {
VStack(spacing: 20) {
ZStack {
Circle()
.fill(.indigo.opacity(0.12))
.frame(width: 100, height: 100)
Image(systemName: "globe.europe.africa")
.font(.system(size: 42))
.foregroundStyle(.indigo)
}
VStack {
Text("Ton univers commence ici.")
.font(.title3.bold())
Text("Crée ton premier monde et commence à construire ton univers.")
.font(.subheadline)
.foregroundStyle(.secondary)
.multilineTextAlignment(.center)
}
.frame(maxWidth: 300)
CreateWorldButton()
}
.frame(maxWidth: .infinity)
.padding(.vertical, 50)
}
}
@@ -8,7 +8,7 @@
import SwiftUI
import SwiftData
struct WorldListToolbarModifier : ViewModifier {
struct WorldListToolbar : ViewModifier {
@Binding var isSelecting : Bool
@Binding var selectedWorlds : Set<World.ID>
@@ -22,14 +22,14 @@
VStack(alignment: .leading, spacing: 24){
if worlds.isEmpty {
EmptyWorldView()
EmptyWorld()
}else{
ScrollView {
LazyVGrid(columns: columns){
ForEach(worlds) {world in
Group {
if isSelecting {
WorldCardView(
WorldCard(
world: world,
isSelected: selectedWorlds.contains(world.id)
)
@@ -44,7 +44,7 @@
NavigationLink{
WorldOverviewView()
} label: {
WorldCardView(world: world)
WorldCard(world: world)
}
}
}
@@ -78,7 +78,7 @@
.padding(.horizontal, 8)
.frame(maxHeight: .infinity, alignment: .topLeading)
.modifier(
WorldListToolbarModifier(
WorldListToolbar(
isSelecting: $isSelecting,
selectedWorlds: $selectedWorlds,
worldsIsEmpty: worlds.isEmpty,