From 34af5e547e0a63b9baaa27841ccfc6a1654ea3aa Mon Sep 17 00:00:00 2001 From: neon443 <69979447+neon443@users.noreply.github.com> Date: Wed, 8 Apr 2026 20:01:31 +0100 Subject: [PATCH] no emojis hinter in pack detail view --- .../Emoji/Categorisation/EmojiPack.swift | 2 +- .../SwiftUI/Emoji/EmojiPackDetailView.swift | 35 +++++++++++++++++-- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/StickerSlack/Emoji/Categorisation/EmojiPack.swift b/StickerSlack/Emoji/Categorisation/EmojiPack.swift index 0e9a5d6..4d5b3c2 100644 --- a/StickerSlack/Emoji/Categorisation/EmojiPack.swift +++ b/StickerSlack/Emoji/Categorisation/EmojiPack.swift @@ -19,7 +19,7 @@ extension EmojiPack { EmojiPack( id: UUID(), name: "New Pack", - description: "Emoji Pack at \(Date().formatted())", + description: "Created on \(Date().formatted())", emojiNames: [] ) } diff --git a/StickerSlack/SwiftUI/Emoji/EmojiPackDetailView.swift b/StickerSlack/SwiftUI/Emoji/EmojiPackDetailView.swift index a0f2c6d..64c81d7 100644 --- a/StickerSlack/SwiftUI/Emoji/EmojiPackDetailView.swift +++ b/StickerSlack/SwiftUI/Emoji/EmojiPackDetailView.swift @@ -33,7 +33,7 @@ struct EmojiPackDetailView: View { Button() { editName.toggle() } label: { - Text(pack.name) + Text(pack.name.isEmpty ? "Name" : pack.name) .bold() .foregroundStyle(edit ? .blue : .primary) .font(.title) @@ -46,7 +46,7 @@ struct EmojiPackDetailView: View { Button() { editDescription.toggle() } label: { - Text(pack.description) + Text(pack.description.isEmpty ? "Description" : pack.description) .foregroundStyle(edit ? .blue : .primary) } .disabled(!edit) @@ -54,6 +54,35 @@ struct EmojiPackDetailView: View { TextField("", text: $pack.description) } + if pack.emojiNames.isEmpty { + VStack(alignment: .center) { + HStack { + Image(systemName: "exclamationmark.triangle.fill") + Text("No Emoji") + .bold() + Image(systemName: "exclamationmark.triangle.fill") + } + .foregroundStyle(.yellow) + Text("This pack contians no emojis 😭") + .padding(.vertical, 5) + .foregroundStyle(.foreground) + Text("Add emojis to this pack by editing it using the pencil button in the toolbar.") + Text("You can also change the name and description by tapping it in edit mode.") + .padding(.vertical, 5) + } + .foregroundStyle(.gray) + .multilineTextAlignment(.center) + .frame(maxWidth: .infinity) + .padding() + .background { + Color.purple.opacity(0.2) + .clipShape(RoundedRectangle(cornerRadius: 10)) + .blur(radius: 5) + .shadow(color: .purple, radius: 5) + } + // .padding(.vertical) + } + let columns: Int = max(1, Int((geo.size.width - 2*spacing) / (minColWidth + spacing))) let layout = Array(repeating: col, count: columns) LazyVGrid(columns: layout, spacing: spacing) { @@ -145,7 +174,7 @@ struct EmojiPackDetailView: View { @available(iOS 17, *) #Preview { - @Previewable @State var pack: EmojiPack = .test + @Previewable @State var pack: EmojiPack = .new() EmojiPackDetailView( hoarder: EmojiHoarder(localOnly: true, skipIndex: false), pack: $pack