remove domain icons on user pages

This commit is contained in:
Dylan Knutson
2025-07-23 07:24:27 +00:00
parent c96b1d9cc1
commit fb436e1b75
5 changed files with 35 additions and 16 deletions

View File

@@ -315,11 +315,19 @@ module Domain::DescriptionsHelper
end
sig do
params(post: Domain::Post, link_text: String, visual_style: String).returns(
T::Hash[Symbol, T.untyped],
)
params(
post: Domain::Post,
link_text: String,
visual_style: String,
domain_icon: T::Boolean,
).returns(T::Hash[Symbol, T.untyped])
end
def props_for_post_hover_preview(post, link_text, visual_style)
def props_for_post_hover_preview(
post,
link_text,
visual_style,
domain_icon: true
)
cache_key = [
post,
policy(post),
@@ -336,7 +344,7 @@ module Domain::DescriptionsHelper
postPath: Rails.application.routes.url_helpers.domain_post_path(post),
postThumbnailPath: thumbnail_for_post_path(post),
postThumbnailAlt: "View on #{domain_name_for_model(post)}",
postDomainIcon: domain_model_icon_path(post),
postDomainIcon: domain_icon ? domain_model_icon_path(post) : nil,
}.then do |props|
if creator = post.primary_creator_for_view
props[:creatorName] = creator.name_for_view

View File

@@ -12,7 +12,7 @@ interface PostHoverPreviewWrapperProps {
postPath: string;
postThumbnailPath: string;
postThumbnailAlt: string;
postDomainIcon: string;
postDomainIcon?: string;
creatorName?: string;
creatorAvatarPath?: string;
}
@@ -43,11 +43,13 @@ export const PostHoverPreviewWrapper: React.FC<
href={postPath}
className={anchorClassNamesForVisualStyle(visualStyle, true)}
>
{postDomainIcon && (
<img
src={postDomainIcon}
alt={postThumbnailAlt}
className={iconClassNamesForSize('small')}
/>
className={iconClassNamesForSize('small')}
/>
)}
{visualStyle === 'description-section-link' && (
<img
src={postDomainIcon}

View File

@@ -3,12 +3,13 @@
<%# description-section-link (smaller and has a border, for use in description section) %>
<% visual_style = local_assigns[:visual_style] || "sky-link" %>
<% link_text = local_assigns[:link_text] || post.title_for_view %>
<% domain_icon = local_assigns[:domain_icon].nil? ? true : local_assigns[:domain_icon] %>
<%=
react_component(
"PostHoverPreviewWrapper",
{
prerender: false,
props: props_for_post_hover_preview(post, link_text, visual_style),
props: props_for_post_hover_preview(post, link_text, visual_style, domain_icon:),
html_options: {
class: link_classes_for_visual_style(visual_style)
}

View File

@@ -8,17 +8,18 @@
<% recent_posts = user.posts.limit(5).to_a %>
<% if recent_posts.any? %>
<% recent_posts.each do |post| %>
<div class="flex items-center px-4 py-2 gap-1">
<span class="grow truncate">
<div class="grid grid-cols-[1fr_auto] items-center px-4 py-2 gap-1 group">
<span class="min-w-0 truncate group-hover:overflow-visible group-hover:whitespace-nowrap group-hover:z-10 group-hover:relative">
<%= render(
partial: "domain/has_description_html/inline_link_domain_post",
locals: {
post: post,
visual_style: "sky-link"
visual_style: "sky-link",
domain_icon: false
}
) %>
</span>
<span class="whitespace-nowrap text-slate-500">
<span class="whitespace-nowrap text-slate-500 ml-2">
<% if posted_at = post.posted_at %>
<%= time_ago_in_words(posted_at) %> ago
<% else %>

View File

@@ -9,9 +9,16 @@
</h2>
<% if fav_posts.any? %>
<% fav_posts.each do |post| %>
<div class="flex flex-col px-4 py-2">
<span class="flex gap-2">
<%= render "domain/has_description_html/inline_link_domain_post", post: post, visual_style: "sky-link" %>
<div class="flex flex-col px-4 py-2 group">
<span class="flex gap-2 group-hover:flex-grow-1">
<%= render(
partial: "domain/has_description_html/inline_link_domain_post",
locals: {
post: post,
visual_style: "sky-link",
domain_icon: false
}
) %>
<span class="whitespace-nowrap flex-grow text-right text-slate-500">
<% if (faved_at = post.user_post_fav&.faved_at) && (time = faved_at.time) %>
<%= time_ago_in_words(faved_at.time) %> ago