From a9da4b4f4fad30082765b96f6fac80ad26904dd4 Mon Sep 17 00:00:00 2001
From: LittleSheep <littlesheep.code@hotmail.com>
Date: Fri, 16 May 2025 15:09:38 +0800
Subject: [PATCH] :lipstick: Optimized creator dashboard

---
 assets/i18n/en-US.json                 |  4 +-
 lib/screens/account/me/publishers.dart |  6 +-
 lib/screens/creators/hub.dart          | 97 ++++++++++++++++++++------
 3 files changed, 81 insertions(+), 26 deletions(-)

diff --git a/assets/i18n/en-US.json b/assets/i18n/en-US.json
index c69f786..ba75915 100644
--- a/assets/i18n/en-US.json
+++ b/assets/i18n/en-US.json
@@ -154,7 +154,6 @@
   "language": "Language",
   "settingsDisplayLanguage": "Display Language",
   "languageFollowSystem": "Follow System",
-  "publisherUnselected": "Unselected",
   "postsCreatedCount": "Posts",
   "stickerPacksCreatedCount": "Sticker Packs",
   "stickersCreatedCount": "Stickers",
@@ -212,5 +211,6 @@
   "walletCurrencyShortPoints": "NSP",
   "walletCurrencyGolds": "The Solar Dollars",
   "walletCurrencyShortGolds": "TSD",
-  "retry": "Retry"
+  "retry": "Retry",
+  "creatorHubUnselectedHint": "Pick / create a publisher to get started."
 }
diff --git a/lib/screens/account/me/publishers.dart b/lib/screens/account/me/publishers.dart
index 1fbb846..093ce36 100644
--- a/lib/screens/account/me/publishers.dart
+++ b/lib/screens/account/me/publishers.dart
@@ -59,7 +59,11 @@ class ManagedPublisherScreen extends HookConsumerWidget {
                     trailing: const Icon(Symbols.chevron_right),
                     contentPadding: const EdgeInsets.symmetric(horizontal: 24),
                     onTap: () {
-                      context.router.push(NewPublisherRoute());
+                      context.router.push(NewPublisherRoute()).then((value) {
+                        if (value != null) {
+                          ref.invalidate(publishersManagedProvider);
+                        }
+                      });
                     },
                   ),
                   const Divider(height: 1),
diff --git a/lib/screens/creators/hub.dart b/lib/screens/creators/hub.dart
index 90a4bc9..d90767c 100644
--- a/lib/screens/creators/hub.dart
+++ b/lib/screens/creators/hub.dart
@@ -79,8 +79,11 @@ class CreatorHubScreen extends HookConsumerWidget {
               hint: CircleAvatar(
                 radius: 16,
                 child: Icon(
-                  Symbols.unknown_med,
-                  color: Theme.of(context).colorScheme.onSecondaryContainer,
+                  Symbols.person,
+                  color: Theme.of(
+                    context,
+                  ).colorScheme.onSecondaryContainer.withOpacity(0.9),
+                  fill: 1,
                 ),
               ).center().padding(right: 8),
               items: [...publishersMenu],
@@ -129,27 +132,75 @@ class CreatorHubScreen extends HookConsumerWidget {
       body: publisherStats.when(
         data:
             (stats) => SingleChildScrollView(
-              child: Column(
-                children: [
-                  if (stats != null)
-                    _PublisherStatsWidget(
-                      stats: stats,
-                    ).padding(vertical: 12, horizontal: 12),
-                  if (currentPublisher.value != null)
-                    ListTile(
-                      minTileHeight: 48,
-                      title: Text('stickers').tr(),
-                      trailing: Icon(Symbols.chevron_right),
-                      leading: const Icon(Symbols.sticky_note),
-                      contentPadding: EdgeInsets.symmetric(horizontal: 24),
-                      onTap: () {
-                        context.router.push(
-                          StickersRoute(pubName: currentPublisher.value!.name),
-                        );
-                      },
-                    ),
-                ],
-              ),
+              child:
+                  currentPublisher.value == null
+                      ? Column(
+                        children: [
+                          const Gap(24),
+                          const Icon(Symbols.info, size: 32).padding(bottom: 4),
+                          Text(
+                            'creatorHubUnselectedHint',
+                            textAlign: TextAlign.center,
+                          ).tr(),
+                          const Gap(24),
+                          const Divider(height: 1),
+                          ...(publishers.value?.map(
+                                (publisher) => ListTile(
+                                  leading: ProfilePictureWidget(
+                                    fileId: publisher.pictureId,
+                                  ),
+                                  title: Text(publisher.nick),
+                                  subtitle: Text('@${publisher.name}'),
+                                  onTap: () {
+                                    currentPublisher.value = publisher;
+                                  },
+                                ),
+                              ) ??
+                              []),
+                          ListTile(
+                            leading: const CircleAvatar(
+                              child: Icon(Symbols.add),
+                            ),
+                            title: Text('createPublisher').tr(),
+                            subtitle: Text('createPublisherHint').tr(),
+                            trailing: const Icon(Symbols.chevron_right),
+                            onTap: () {
+                              context.router.push(NewPublisherRoute()).then((
+                                value,
+                              ) {
+                                if (value != null) {
+                                  ref.invalidate(publishersManagedProvider);
+                                }
+                              });
+                            },
+                          ),
+                        ],
+                      )
+                      : Column(
+                        children: [
+                          if (stats != null)
+                            _PublisherStatsWidget(
+                              stats: stats,
+                            ).padding(vertical: 12, horizontal: 12),
+                          if (currentPublisher.value != null)
+                            ListTile(
+                              minTileHeight: 48,
+                              title: Text('stickers').tr(),
+                              trailing: Icon(Symbols.chevron_right),
+                              leading: const Icon(Symbols.sticky_note),
+                              contentPadding: EdgeInsets.symmetric(
+                                horizontal: 24,
+                              ),
+                              onTap: () {
+                                context.router.push(
+                                  StickersRoute(
+                                    pubName: currentPublisher.value!.name,
+                                  ),
+                                );
+                              },
+                            ),
+                        ],
+                      ),
             ),
         loading: () => const Center(child: CircularProgressIndicator()),
         error: (_, __) => const SizedBox.shrink(),