extracted logic for packs, reorg

This commit is contained in:
neon443 committed 2026-04-09 00:58:59 +01:00
1 parent 8f3c22cc43
commit 68b63083a5
9 files changed
+46 -26

No files matched your search

@@ -98,9 +98,7 @@ struct EmojiPackDetailView: View {
.overlay(alignment: .topLeading) {
if edit {
Button(role: .destructive) {
withAnimation(.spring) {
pack.items.removeAll { $0 == name }
}
pack.remove(name)
} label: {
Image(systemName: "minus.circle.fill")
.resizable().scaledToFit()
@@ -128,10 +126,7 @@ struct EmojiPackDetailView: View {
.sheet(isPresented: $showAdder) {
NavigationStack {
SearchView(hoarder: hoarder, fromPackEditor: true) { selection in
print(selection)
withAnimation {
pack.items.append(selection.name)
}
pack.add(selection.name)
}
.navigationTitle("Search Emojis")
.navigationBarTitleDisplayMode(.inline)
@@ -0,0 +1,61 @@
//
// EmojiPackManager.swift
// StickerSlack
//
// Created by neon443 on 01/12/2025.
//
import SwiftUI
struct EmojiPackManager: View {
@ObservedObject var hoarder: EmojiHoarder
var body: some View {
NavigationStack {
List {
ForEach($hoarder.emojiPacks) { $pack in
NavigationLink {
EmojiPackDetailView(hoarder: hoarder, pack: $pack)
} label: {
Text(pack.name)
}
.swipeActions(edge: .trailing) {
Button {
withAnimation {
hoarder.emojiPacks.removeAll { $0.id == pack.id }
}
} label: {
Label("Delete", systemImage: "trash")
}
.tint(.red)
}
}
Spacer()
NavigationLink {
EmojiPackDetailView(hoarder: hoarder, pack: .constant(.test))
} label: {
Text("test")
}
}
.navigationTitle("Emoji Packs")
.navigationBarTitleDisplayMode(.inline)
.toolbar {
ToolbarItem {
Button {
hoarder.emojiPacks.append(.new())
} label: {
Image(systemName: "plus")
}
.tint(.accentColor)
.modifier(glassButtonIfAv())
}
}
}
}
}
#Preview {
EmojiPackManager(
hoarder: EmojiHoarder(localOnly: true, skipIndex: true)
)
}
File renamed without changes.
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.