Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use new user/community styles #1227

Merged
merged 2 commits into from
Mar 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions lib/community/pages/create_post_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -789,10 +789,12 @@ class _CommunitySelectorState extends State<CommunitySelector> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('${widget.communityView?.community.title} '),
Text(
generateCommunityFullName(context, widget.communityView?.community.name, fetchInstanceNameFromUrl(widget.communityView?.community.actorId)),
style: theme.textTheme.bodySmall,
),
generateCommunityFullNameWidget(
context,
widget.communityView?.community.name,
fetchInstanceNameFromUrl(widget.communityView?.community.actorId),
textStyle: theme.textTheme.bodySmall,
)
],
)
: SizedBox(
Expand Down
7 changes: 5 additions & 2 deletions lib/community/widgets/community_header.dart
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,11 @@ class _CommunityHeaderState extends State<CommunityHeader> {
widget.getCommunityResponse.communityView.community.title,
style: theme.textTheme.headlineSmall?.copyWith(fontWeight: FontWeight.w600),
),
Text(generateCommunityFullName(
context, widget.getCommunityResponse.communityView.community.name, fetchInstanceNameFromUrl(widget.getCommunityResponse.communityView.community.actorId) ?? 'N/A')),
generateCommunityFullNameWidget(
context,
widget.getCommunityResponse.communityView.community.name,
fetchInstanceNameFromUrl(widget.getCommunityResponse.communityView.community.actorId) ?? 'N/A',
),
const SizedBox(height: 8.0),
Row(
children: [
Expand Down
7 changes: 4 additions & 3 deletions lib/community/widgets/community_list_entry.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ class CommunityListEntry extends StatelessWidget {
),
subtitle: Row(children: [
Flexible(
child: Text(
generateCommunityFullName(context, communityView.community.name, fetchInstanceNameFromUrl(communityView.community.actorId)),
overflow: TextOverflow.ellipsis,
child: generateCommunityFullNameWidget(
context,
communityView.community.name,
fetchInstanceNameFromUrl(communityView.community.actorId),
),
),
Text(
Expand Down
9 changes: 5 additions & 4 deletions lib/community/widgets/community_sidebar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,11 @@ class CommunityModeratorList extends StatelessWidget {
fontSize: 16,
),
),
Text(
generateUserFullName(context, mods.moderator.name, fetchInstanceNameFromUrl(mods.moderator.actorId)),
overflow: TextOverflow.ellipsis,
style: TextStyle(
generateUserFullNameWidget(
context,
mods.moderator.name,
fetchInstanceNameFromUrl(mods.moderator.actorId),
textStyle: TextStyle(
color: theme.colorScheme.onBackground.withOpacity(0.6),
fontSize: 13,
),
Expand Down
26 changes: 16 additions & 10 deletions lib/community/widgets/post_card_metadata.dart
Original file line number Diff line number Diff line change
Expand Up @@ -561,13 +561,17 @@ class PostCommunityAndAuthor extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: [
InkWell(
borderRadius: BorderRadius.circular(6),
onTap: (compactMode && !state.tappableAuthorCommunity) ? null : () => navigateToFeedPage(context, feedType: FeedType.user, userId: postView.creator.id),
child: ScalableText(
'$creatorName',
fontScale: state.metadataFontSizeScale,
style: textStyleAuthor,
)),
borderRadius: BorderRadius.circular(6),
onTap: (compactMode && !state.tappableAuthorCommunity) ? null : () => navigateToFeedPage(context, feedType: FeedType.user, userId: postView.creator.id),
child: generateUserFullNameWidget(
context,
creatorName,
fetchInstanceNameFromUrl(postView.creator.actorId),
includeInstance: state.postShowUserInstance,
fontScale: state.metadataFontSizeScale,
textStyle: textStyleAuthor,
),
),
if (!communityMode)
ScalableText(
' to ',
Expand All @@ -585,10 +589,12 @@ class PostCommunityAndAuthor extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: [
if (!communityMode)
ScalableText(
generateCommunityFullName(context, postView.community.name, fetchInstanceNameFromUrl(postView.community.actorId)),
generateCommunityFullNameWidget(
context,
postView.community.name,
fetchInstanceNameFromUrl(postView.community.actorId),
fontScale: state.metadataFontSizeScale,
style: textStyleCommunity,
textStyle: textStyleCommunity,
),
if (showCommunitySubscription)
Padding(
Expand Down
14 changes: 12 additions & 2 deletions lib/core/enums/local_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ enum LocalSettings {
name: 'setting_compact_show_thumbnail_on_right', key: 'showThumbnailPreviewOnRight', category: LocalSettingsCategories.posts, subCategory: LocalSettingsSubCategories.posts),
showTextPostIndicator(name: 'setting_compact_show_text_post_indicator', key: 'showTextPostIndicator', category: LocalSettingsCategories.posts, subCategory: LocalSettingsSubCategories.posts),
tappableAuthorCommunity(name: 'setting_compact_tappable_author_community', key: 'tappableAuthorCommunity', category: LocalSettingsCategories.general, subCategory: LocalSettingsSubCategories.feed),
postBodyViewType(name: 'setting_general_post_body_view_type', key: 'postBodyViewType', category: LocalSettingsCategories.posts, subCategory: LocalSettingsSubCategories.general),

// General Settings
showPostVoteActions(name: 'setting_general_show_vote_actions', key: 'showPostVoteActions', category: LocalSettingsCategories.posts, subCategory: LocalSettingsSubCategories.cardView),
Expand All @@ -117,8 +116,8 @@ enum LocalSettings {
showPostEdgeToEdgeImages(name: 'setting_general_show_edge_to_edge_images', key: 'showEdgeToEdgeImages', category: LocalSettingsCategories.posts, subCategory: LocalSettingsSubCategories.cardView),
showPostTextContentPreview(name: 'setting_general_show_text_content', key: 'showPostTextContentPreview', category: LocalSettingsCategories.posts, subCategory: LocalSettingsSubCategories.cardView),
showPostAuthor(name: 'setting_general_show_post_author', key: 'showPostAuthor', category: LocalSettingsCategories.posts, subCategory: LocalSettingsSubCategories.general),
postShowUserInstance(name: 'setting_general_post_show_user_instance', key: 'postShowUserInstance', category: LocalSettingsCategories.posts, subCategory: LocalSettingsSubCategories.general),
dimReadPosts(name: 'setting_dim_read_posts', key: 'dimReadPosts', category: LocalSettingsCategories.posts, subCategory: LocalSettingsSubCategories.general),
showCrossPosts(name: 'setting_show_cross_posts', key: 'showCrossPosts', category: LocalSettingsCategories.posts, subCategory: LocalSettingsSubCategories.general),
keywordFilters(name: 'setting_general_keyword_filters', key: 'keywordFilters', category: LocalSettingsCategories.filters, subCategory: LocalSettingsSubCategories.filters),
hideTopBarOnScroll(name: 'setting_general_hide_topbar_on_scroll', key: 'hideTopBarOnScroll', category: LocalSettingsCategories.general, subCategory: LocalSettingsSubCategories.feed),
compactPostCardMetadataItems(
Expand All @@ -127,6 +126,14 @@ enum LocalSettings {
showFullPostDate(name: 'setting_general_show_full_post_date', key: 'showFullPostDate', category: LocalSettingsCategories.posts, subCategory: LocalSettingsSubCategories.posts),
dateFormat(name: 'setting_general_date_format', key: 'dateFormat', category: LocalSettingsCategories.posts, subCategory: LocalSettingsSubCategories.posts),

// Post body settings
showCrossPosts(name: 'setting_show_cross_posts', key: 'showCrossPosts', category: LocalSettingsCategories.posts, subCategory: LocalSettingsSubCategories.general),
postBodyViewType(name: 'setting_general_post_body_view_type', key: 'postBodyViewType', category: LocalSettingsCategories.posts, subCategory: LocalSettingsSubCategories.general),
postBodyShowUserInstance(
name: 'setting_general_post_body_show_user_instance', key: 'postBodyShowUserInstance', category: LocalSettingsCategories.posts, subCategory: LocalSettingsSubCategories.general),
postBodyShowCommunityInstance(
name: 'setting_general_post_body_show_community_instance', key: 'postBodyShowCommunityInstance', category: LocalSettingsCategories.posts, subCategory: LocalSettingsSubCategories.general),

// Advanced Settings
userFormat(name: 'user_format', key: 'userFormat', category: LocalSettingsCategories.general, subCategory: LocalSettingsSubCategories.advanced),
// This setting exists purely for the searching function
Expand Down Expand Up @@ -311,10 +318,13 @@ extension LocalizationExt on AppLocalizations {
'showEdgeToEdgeImages': showEdgeToEdgeImages,
'showPostTextContentPreview': showPostTextContentPreview,
'showPostAuthor': showPostAuthor,
'postShowUserInstance': postShowUserInstance,
'dimReadPosts': dimReadPosts,
'showFullPostDate': showFullDate,
'dateFormat': dateFormat,
'showCrossPosts': showCrossPosts,
'postBodyShowUserInstance': postBodyShowUserInstance,
'postBodyShowCommunityInstance': postBodyShowCommunityInstance,
'keywordFilters': keywordFilters,
'hideTopBarOnScroll': hideTopBarOnScroll,
'compactPostCardMetadataItems': compactPostCardMetadataItems,
Expand Down
3 changes: 2 additions & 1 deletion lib/feed/utils/post.dart
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ Future<PostViewMedia?> createExamplePost({
bool? pinned,
String? personName,
String? personDisplayName,
String? personInstance,
String? communityName,
String? instanceUrl,
int? commentCount,
Expand Down Expand Up @@ -181,7 +182,7 @@ Future<PostViewMedia?> createExamplePost({
displayName: personDisplayName ?? 'Example Name',
banned: false,
published: DateTime.now(),
actorId: '',
actorId: 'https://$personInstance/u/$personName',
local: false,
deleted: false,
botAccount: false,
Expand Down
8 changes: 5 additions & 3 deletions lib/inbox/widgets/inbox_mentions_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,11 @@ class InboxMentionsView extends StatelessWidget {
],
),
GestureDetector(
child: Text(
generateCommunityFullName(context, mentions[index].community.name, fetchInstanceNameFromUrl(mentions[index].community.actorId)),
style: theme.textTheme.bodyMedium?.copyWith(
child: generateCommunityFullNameWidget(
context,
mentions[index].community.name,
fetchInstanceNameFromUrl(mentions[index].community.actorId),
textStyle: theme.textTheme.bodyMedium?.copyWith(
color: theme.textTheme.bodyMedium?.color?.withOpacity(0.75),
),
),
Expand Down
12 changes: 12 additions & 0 deletions lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -1063,6 +1063,14 @@
"@postBodySettingsDescription": {
"description": "Description of post body settings"
},
"postBodyShowCommunityInstance": "Show Community Instance",
"@postBodyShowCommunityInstance": {
"description": "Whether to show the community instance for post bodies"
},
"postBodyShowUserInstance": "Show User Instance",
"@postBodyShowUserInstance": {
"description": "Whether to show the user instance for post bodies"
},
"postBodyViewType": "Post Body View Type",
"@postBodyViewType": {
"description": "Setting name for the post body view type setting"
Expand All @@ -1089,6 +1097,10 @@
},
"postSavedAsDraft": "Post saved as draft",
"@postSavedAsDraft": {},
"postShowUserInstance": "Show User Instance",
"@postShowUserInstance": {
"description": "Whether to show the user instance for post listings"
},
"postSwipeActions": "Post Swipe Actions",
"@postSwipeActions": {
"description": "Setting for post swipe actions"
Expand Down
12 changes: 7 additions & 5 deletions lib/modlog/widgets/modlog_feed_page_app_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,13 @@ class ModlogFeedAppBarTitle extends StatelessWidget {
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
subtitle: Text(
feedState.fullCommunityView != null
? generateCommunityFullName(context, feedState.fullCommunityView!.communityView.community.name, fetchInstanceNameFromUrl(feedState.fullCommunityView!.communityView.community.actorId))
: lemmyClient.lemmyApiV3.host,
),
subtitle: feedState.fullCommunityView != null
? generateCommunityFullNameWidget(
context,
feedState.fullCommunityView!.communityView.community.name,
fetchInstanceNameFromUrl(feedState.fullCommunityView!.communityView.community.actorId),
)
: Text(lemmyClient.lemmyApiV3.host),
contentPadding: const EdgeInsets.symmetric(horizontal: 0),
),
);
Expand Down
33 changes: 20 additions & 13 deletions lib/modlog/widgets/modlog_item_context_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,12 @@ class ModlogPostItemContextCard extends StatelessWidget {
child: InkWell(
borderRadius: BorderRadius.circular(6),
onTap: () => navigateToFeedPage(context, feedType: FeedType.community, communityId: community?.id),
child: ScalableText(
generateCommunityFullName(context, community?.name, fetchInstanceNameFromUrl(community?.actorId)),
child: generateCommunityFullNameWidget(
context,
community?.name,
fetchInstanceNameFromUrl(community?.actorId),
fontScale: state.metadataFontSizeScale,
style: theme.textTheme.bodyMedium?.copyWith(
textStyle: theme.textTheme.bodyMedium?.copyWith(
color: theme.textTheme.bodyMedium?.color?.withOpacity(0.75),
),
),
Expand Down Expand Up @@ -278,10 +280,12 @@ class _ModlogCommentItemContextCardState extends State<ModlogCommentItemContextC
InkWell(
borderRadius: BorderRadius.circular(6),
onTap: () => navigateToFeedPage(context, feedType: FeedType.community, communityId: widget.community?.id),
child: ScalableText(
generateCommunityFullName(context, widget.community?.name, fetchInstanceNameFromUrl(widget.community?.actorId)),
child: generateCommunityFullNameWidget(
context,
widget.community?.name,
fetchInstanceNameFromUrl(widget.community?.actorId),
fontScale: state.metadataFontSizeScale,
style: textStyleCommunityAndAuthor,
textStyle: textStyleCommunityAndAuthor,
),
),
],
Expand Down Expand Up @@ -336,10 +340,11 @@ class ModlogUserItemContextCard extends StatelessWidget {
style: theme.textTheme.bodyMedium?.copyWith(fontWeight: FontWeight.w600),
fontScale: state.titleFontSizeScale,
),
ScalableText(
user == null ? '-' : generateUserFullName(context, user?.name, fetchInstanceNameFromUrl(user?.actorId)),
fontScale: state.metadataFontSizeScale,
style: theme.textTheme.bodyMedium?.copyWith(
generateUserFullNameWidget(
context,
user?.name,
fetchInstanceNameFromUrl(user?.actorId),
textStyle: theme.textTheme.bodyMedium?.copyWith(
color: theme.textTheme.bodyMedium?.color?.withOpacity(0.75),
),
),
Expand Down Expand Up @@ -393,10 +398,12 @@ class ModlogCommunityItemContextCard extends StatelessWidget {
style: theme.textTheme.bodyMedium?.copyWith(fontWeight: FontWeight.w600),
fontScale: state.titleFontSizeScale,
),
ScalableText(
generateCommunityFullName(context, community?.name, fetchInstanceNameFromUrl(community?.actorId)),
generateCommunityFullNameWidget(
context,
community?.name,
fetchInstanceNameFromUrl(community?.actorId),
fontScale: state.metadataFontSizeScale,
style: theme.textTheme.bodyMedium?.copyWith(
textStyle: theme.textTheme.bodyMedium?.copyWith(
color: theme.textTheme.bodyMedium?.color?.withOpacity(0.75),
),
),
Expand Down
Loading
Loading