mirror of
https://github.com/neon443/StickerSlack.git
synced 2026-11-30 12:44:51 +00:00
extracted logic for packs, reorg
This commit is contained in:
9 files changed
+46
-26
No files matched your search
+2
-7
@@ -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.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.