change List view UI disposition
This commit is contained in:
1 parent
33c9937547
commit
d12292e6af
6 files changed
+48
-8
No files matched your search
+1
-1
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
struct CreateWorldButtonView : View {
|
struct CreateWorldButton : View {
|
||||||
var body: some View {
|
var body: some View {
|
||||||
NavigationLink{
|
NavigationLink{
|
||||||
CreateWorldView()
|
CreateWorldView()
|
||||||
+1
-1
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
struct WorldCardView : View {
|
struct WorldCard : View {
|
||||||
var world : World
|
var world : World
|
||||||
var isSelected = false
|
var isSelected = false
|
||||||
|
|
||||||
@@ -9,6 +9,6 @@ import SwiftUI
|
|||||||
|
|
||||||
struct HomeView : View {
|
struct HomeView : View {
|
||||||
var body: some 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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
import SwiftUI
|
import SwiftUI
|
||||||
import SwiftData
|
import SwiftData
|
||||||
|
|
||||||
struct WorldListToolbarModifier : ViewModifier {
|
struct WorldListToolbar : ViewModifier {
|
||||||
@Binding var isSelecting : Bool
|
@Binding var isSelecting : Bool
|
||||||
@Binding var selectedWorlds : Set<World.ID>
|
@Binding var selectedWorlds : Set<World.ID>
|
||||||
|
|
||||||
@@ -22,14 +22,14 @@
|
|||||||
VStack(alignment: .leading, spacing: 24){
|
VStack(alignment: .leading, spacing: 24){
|
||||||
|
|
||||||
if worlds.isEmpty {
|
if worlds.isEmpty {
|
||||||
EmptyWorldView()
|
EmptyWorld()
|
||||||
}else{
|
}else{
|
||||||
ScrollView {
|
ScrollView {
|
||||||
LazyVGrid(columns: columns){
|
LazyVGrid(columns: columns){
|
||||||
ForEach(worlds) {world in
|
ForEach(worlds) {world in
|
||||||
Group {
|
Group {
|
||||||
if isSelecting {
|
if isSelecting {
|
||||||
WorldCardView(
|
WorldCard(
|
||||||
world: world,
|
world: world,
|
||||||
isSelected: selectedWorlds.contains(world.id)
|
isSelected: selectedWorlds.contains(world.id)
|
||||||
)
|
)
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
NavigationLink{
|
NavigationLink{
|
||||||
WorldOverviewView()
|
WorldOverviewView()
|
||||||
} label: {
|
} label: {
|
||||||
WorldCardView(world: world)
|
WorldCard(world: world)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -78,7 +78,7 @@
|
|||||||
.padding(.horizontal, 8)
|
.padding(.horizontal, 8)
|
||||||
.frame(maxHeight: .infinity, alignment: .topLeading)
|
.frame(maxHeight: .infinity, alignment: .topLeading)
|
||||||
.modifier(
|
.modifier(
|
||||||
WorldListToolbarModifier(
|
WorldListToolbar(
|
||||||
isSelecting: $isSelecting,
|
isSelecting: $isSelecting,
|
||||||
selectedWorlds: $selectedWorlds,
|
selectedWorlds: $selectedWorlds,
|
||||||
worldsIsEmpty: worlds.isEmpty,
|
worldsIsEmpty: worlds.isEmpty,
|
||||||
|
|||||||
Reference in new issue
Block a user