Link channel to Lemmy page

This commit is contained in:
myrmidex 2025-08-11 18:31:22 +02:00
parent d59128871e
commit 4af7b8a38c

View file

@ -127,13 +127,24 @@ const Channels: React.FC = () => {
</div> </div>
<div className="ml-4 flex-1"> <div className="ml-4 flex-1">
<div className="flex items-center justify-between"> <div className="flex items-center justify-between">
<div className="flex items-center space-x-2 flex-1 min-w-0">
<h3 className="text-lg font-medium text-gray-900 truncate"> <h3 className="text-lg font-medium text-gray-900 truncate">
{channel.display_name || channel.name} !{channel.name}@{channel.platform_instance?.url?.replace(/^https?:\/\//, '')}
</h3> </h3>
<a
href={`https://${channel.platform_instance?.url?.replace(/^https?:\/\//, '')}/c/${channel.name}`}
target="_blank"
rel="noopener noreferrer"
className="text-gray-400 hover:text-gray-600 flex-shrink-0"
title="View community on Lemmy"
>
<ExternalLink className="h-4 w-4" />
</a>
</div>
<button <button
onClick={() => handleToggle(channel.id)} onClick={() => handleToggle(channel.id)}
disabled={toggleMutation.isPending} disabled={toggleMutation.isPending}
className="ml-2" className="ml-2 flex-shrink-0"
title={channel.is_active ? 'Deactivate channel' : 'Activate channel'} title={channel.is_active ? 'Deactivate channel' : 'Activate channel'}
> >
{channel.is_active ? ( {channel.is_active ? (
@ -143,8 +154,8 @@ const Channels: React.FC = () => {
)} )}
</button> </button>
</div> </div>
{channel.display_name && channel.display_name !== channel.name && ( {channel.display_name && (
<p className="text-sm text-gray-500">@{channel.name}</p> <p className="text-sm text-gray-500">{channel.display_name}</p>
)} )}
</div> </div>
</div> </div>
@ -167,7 +178,6 @@ const Channels: React.FC = () => {
{channel.platform_accounts?.length || 0} account{(channel.platform_accounts?.length || 0) !== 1 ? 's' : ''} linked {channel.platform_accounts?.length || 0} account{(channel.platform_accounts?.length || 0) !== 1 ? 's' : ''} linked
</span> </span>
</div> </div>
<div className="flex items-center space-x-2">
<button <button
onClick={() => setShowAccountModal({ channelId: channel.id, channelName: channel.display_name || channel.name })} onClick={() => setShowAccountModal({ channelId: channel.id, channelName: channel.display_name || channel.name })}
className="text-blue-500 hover:text-blue-600" className="text-blue-500 hover:text-blue-600"
@ -175,13 +185,6 @@ const Channels: React.FC = () => {
> >
<Settings className="h-4 w-4" /> <Settings className="h-4 w-4" />
</button> </button>
<button
className="text-gray-400 hover:text-gray-500"
title="View channel"
>
<ExternalLink className="h-4 w-4" />
</button>
</div>
</div> </div>
{channel.platform_accounts && channel.platform_accounts.length > 0 && ( {channel.platform_accounts && channel.platform_accounts.length > 0 && (