no emojis hinter in pack detail view

This commit is contained in:
neon443 committed 2026-04-08 20:01:31 +01:00
1 parent e3436f1fc9
commit 34af5e547e
2 files changed
+33 -4

No files matched your search

@@ -19,7 +19,7 @@ extension EmojiPack {
EmojiPack( EmojiPack(
id: UUID(), id: UUID(),
name: "New Pack", name: "New Pack",
description: "Emoji Pack at \(Date().formatted())", description: "Created on \(Date().formatted())",
emojiNames: [] emojiNames: []
) )
} }
@@ -33,7 +33,7 @@ struct EmojiPackDetailView: View {
Button() { Button() {
editName.toggle() editName.toggle()
} label: { } label: {
Text(pack.name) Text(pack.name.isEmpty ? "Name" : pack.name)
.bold() .bold()
.foregroundStyle(edit ? .blue : .primary) .foregroundStyle(edit ? .blue : .primary)
.font(.title) .font(.title)
@@ -46,7 +46,7 @@ struct EmojiPackDetailView: View {
Button() { Button() {
editDescription.toggle() editDescription.toggle()
} label: { } label: {
Text(pack.description) Text(pack.description.isEmpty ? "Description" : pack.description)
.foregroundStyle(edit ? .blue : .primary) .foregroundStyle(edit ? .blue : .primary)
} }
.disabled(!edit) .disabled(!edit)
@@ -54,6 +54,35 @@ struct EmojiPackDetailView: View {
TextField("", text: $pack.description) 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 columns: Int = max(1, Int((geo.size.width - 2*spacing) / (minColWidth + spacing)))
let layout = Array(repeating: col, count: columns) let layout = Array(repeating: col, count: columns)
LazyVGrid(columns: layout, spacing: spacing) { LazyVGrid(columns: layout, spacing: spacing) {
@@ -145,7 +174,7 @@ struct EmojiPackDetailView: View {
@available(iOS 17, *) @available(iOS 17, *)
#Preview { #Preview {
@Previewable @State var pack: EmojiPack = .test @Previewable @State var pack: EmojiPack = .new()
EmojiPackDetailView( EmojiPackDetailView(
hoarder: EmojiHoarder(localOnly: true, skipIndex: false), hoarder: EmojiHoarder(localOnly: true, skipIndex: false),
pack: $pack pack: $pack
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.