diff --git a/lib/screens/dashboard/dash.dart b/lib/screens/dashboard/dash.dart index c7c6b39f..f1c53d2b 100644 --- a/lib/screens/dashboard/dash.dart +++ b/lib/screens/dashboard/dash.dart @@ -21,6 +21,7 @@ import 'package:island/widgets/app_scaffold.dart'; import 'package:island/widgets/notification_tile.dart'; import 'package:island/widgets/post/post_featured.dart'; import 'package:island/widgets/check_in.dart'; +import 'package:island/screens/auth/login_modal.dart'; import 'package:island/models/activity.dart'; import 'package:island/screens/notification.dart'; import 'package:material_symbols_icons/material_symbols_icons.dart'; @@ -116,7 +117,11 @@ class DashboardGrid extends HookConsumerWidget { topRight: isWide ? 0 : 12, ) .padding(horizontal: isWide ? 0 : 16), - ), + ) + else + Center( + child: _UnauthorizedCard(isWide: isWide), + ).padding(horizontal: isWide ? 24 : 16), ], ), ); @@ -303,7 +308,9 @@ class ClockCard extends HookConsumerWidget { spacing: 5, children: [ notableDay.when( - data: (day) => _buildNotableDayText(context, day!), + data: (day) => day == null + ? Text('unauthorized').tr() + : _buildNotableDayText(context, day), error: (err, _) => Text(err.toString()).fontSize(12), loading: () => @@ -555,3 +562,64 @@ class FortuneCard extends HookConsumerWidget { ).height(48); } } + +class _UnauthorizedCard extends HookConsumerWidget { + final bool isWide; + const _UnauthorizedCard({required this.isWide}); + + @override + Widget build(BuildContext context, WidgetRef ref) { + return Card( + margin: EdgeInsets.zero, + child: Padding( + padding: EdgeInsets.symmetric( + horizontal: isWide ? 48 : 32, + vertical: 32, + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisSize: MainAxisSize.min, + children: [ + const Gap(16), + Icon( + Symbols.dashboard_rounded, + size: 64, + color: Theme.of(context).colorScheme.primary, + fill: 1, + ), + const Gap(16), + Text( + 'Welcome to\nthe Solar Network', + style: Theme.of( + context, + ).textTheme.headlineSmall?.copyWith(fontWeight: FontWeight.bold), + textAlign: TextAlign.center, + ), + const Gap(8), + Text( + 'Login to access your personalized dashboard with friends, notifications, chats, and more!', + style: Theme.of(context).textTheme.bodyLarge?.copyWith( + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), + textAlign: TextAlign.center, + ), + const Gap(12), + FilledButton.icon( + onPressed: () { + showModalBottomSheet( + context: context, + useRootNavigator: true, + isScrollControlled: true, + builder: (context) => const LoginModal(), + ); + }, + icon: const Icon(Symbols.login), + label: Text('login').tr(), + ), + ], + ), + ), + ); + } +} diff --git a/lib/widgets/app_scaffold.dart b/lib/widgets/app_scaffold.dart index 56e9d7bf..0f7f371c 100644 --- a/lib/widgets/app_scaffold.dart +++ b/lib/widgets/app_scaffold.dart @@ -584,6 +584,10 @@ class _WebSocketIndicator extends HookConsumerWidget { isInteractive = false; } + if (user.value == null) { + opacity = 0.0; + } + return Positioned( top: devicePadding.top + (isDesktop ? 27.5 : 25), left: 0, diff --git a/lib/widgets/content/markdown.dart b/lib/widgets/content/markdown.dart index 3141d3c3..8f9624d3 100644 --- a/lib/widgets/content/markdown.dart +++ b/lib/widgets/content/markdown.dart @@ -39,6 +39,7 @@ class MarkdownTextContent extends HookConsumerWidget { final List extraInlineSyntaxList; final List extraBlockSyntaxList; final List extraGenerators; + final bool noMentionChip; const MarkdownTextContent({ super.key, @@ -53,6 +54,7 @@ class MarkdownTextContent extends HookConsumerWidget { this.extraInlineSyntaxList = const [], this.extraBlockSyntaxList = const [], this.extraGenerators = const [], + this.noMentionChip = false, }); @override @@ -224,7 +226,7 @@ class MarkdownTextContent extends HookConsumerWidget { isDark: isDark, linesMargin: linesMargin, generators: [ - mentionGenerator, + if (!noMentionChip) mentionGenerator, highlightGenerator, spoilerGenerator, stickerGenerator, @@ -431,11 +433,13 @@ class MentionChipSpanNode extends SpanNode { fallbackIcon: Symbols.person_rounded, radius: 9, ), - error: (_, _) => const Icon(Symbols.close), + error: (_, _) => const Icon(Symbols.close, size: 20), loading: () => const SizedBox( - width: 9, - height: 9, - child: CircularProgressIndicator(), + width: 20, + height: 20, + child: CircularProgressIndicator( + padding: EdgeInsets.zero, + ), ), ); }, @@ -449,11 +453,13 @@ class MentionChipSpanNode extends SpanNode { fallbackIcon: Symbols.design_services_rounded, radius: 9, ), - error: (_, _) => const Icon(Symbols.close), + error: (_, _) => const Icon(Symbols.close, size: 20), loading: () => const SizedBox( - width: 9, - height: 9, - child: CircularProgressIndicator(), + width: 20, + height: 20, + child: CircularProgressIndicator( + padding: EdgeInsets.zero, + ), ), ); }, diff --git a/lib/widgets/post/post_item.dart b/lib/widgets/post/post_item.dart index 5c3949b6..084df381 100644 --- a/lib/widgets/post/post_item.dart +++ b/lib/widgets/post/post_item.dart @@ -425,6 +425,7 @@ class PostItem extends HookConsumerWidget { content: translatedText.value!, isSelectable: isTextSelectable, attachments: item.attachments, + noMentionChip: item.fediverseUri != null, ), ], ) diff --git a/lib/widgets/post/post_item_screenshot.dart b/lib/widgets/post/post_item_screenshot.dart index 1455b309..da721799 100644 --- a/lib/widgets/post/post_item_screenshot.dart +++ b/lib/widgets/post/post_item_screenshot.dart @@ -205,6 +205,7 @@ class PostItemScreenshot extends ConsumerWidget { child: MarkdownTextContent( content: post.content!, attachments: post.attachments, + noMentionChip: item.fediverseUri != null, ).padding(top: 2), ) else diff --git a/lib/widgets/post/post_shared.dart b/lib/widgets/post/post_shared.dart index d613e329..83a95844 100644 --- a/lib/widgets/post/post_shared.dart +++ b/lib/widgets/post/post_shared.dart @@ -199,6 +199,7 @@ class PostReplyPreview extends HookConsumerWidget { child: MarkdownTextContent( content: _convertContentToMarkdown(post), attachments: post.attachments, + noMentionChip: post.fediverseUri != null, ).padding(top: 2), ) else @@ -607,6 +608,7 @@ class ReferencedPostWidget extends StatelessWidget { ? const EdgeInsets.only(bottom: 4) : null, attachments: item.attachments, + noMentionChip: item.fediverseUri != null, ).padding(bottom: 4), if (referencePost.isTruncated) const PostTruncateHint( @@ -1070,6 +1072,7 @@ class PostBody extends ConsumerWidget { MarkdownTextContent( content: '${_convertContentToMarkdown(item)}...', attachments: item.attachments, + noMentionChip: item.fediverseUri != null, ), ], ), @@ -1109,6 +1112,7 @@ class PostBody extends ConsumerWidget { : _convertContentToMarkdown(item), isSelectable: isTextSelectable, attachments: item.attachments, + noMentionChip: item.fediverseUri != null, ), if (translationSection != null) translationSection!, ],