-
Notifications
You must be signed in to change notification settings - Fork 471
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Front fixes - Logs error and server components (#741)
Fixing this errors related to server components insider client components ![image](https://github.com/user-attachments/assets/3e5ec71b-9cd1-42e7-970e-3e2807f165d6) <!-- This is an auto-generated comment: release notes by OSS Entelligence.AI --> ### Summary by Entelligence.AI - Refactor: Enhanced the `IdentifyPlugin` component to handle loading states and error components, improving user experience during data retrieval. - Style: Adjusted the styling attributes of certain components for better visual consistency. - Chore: Cleaned up redundant empty lines in the code for improved readability and maintainability. - Refactor: Updated the rendering location of the `Plugins` component in the `Summary` component, optimizing the conditional rendering based on the length of `memory.plugins_results`. <!-- end of auto-generated comment: release notes by OSS Entelligence.AI -->
- Loading branch information
Showing
5 changed files
with
38 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,57 @@ | ||
'use client'; | ||
|
||
import { getCommunityPlugin } from '@/src/actions/plugins/get-community-plugins'; | ||
import { CommunityPlugin } from '@/src/types/plugins/plugins.types'; | ||
import Image from 'next/image'; | ||
import { Fragment, useEffect, useState } from 'react'; | ||
import ErrorIdentifyPlugin from './error-identify-plugin'; | ||
import IdentifyPluginLoader from './identify-plugin-loader'; | ||
|
||
interface IndentifyPluginProps { | ||
pluginId: string; | ||
} | ||
|
||
export default async function IndentifyPlugin({ pluginId }: IndentifyPluginProps) { | ||
const pluginCommunity = await getCommunityPlugin(pluginId); | ||
if (!pluginCommunity) throw new Error('Plugin not found'); | ||
export default function IndentifyPlugin({ pluginId }: IndentifyPluginProps) { | ||
const [pluginCommunity, setPluginCommunity] = useState<CommunityPlugin | undefined>( | ||
undefined, | ||
); | ||
const [loading, setLoading] = useState(true); | ||
|
||
useEffect(() => { | ||
getCommunityPlugin(pluginId) | ||
.then((plugin) => { | ||
setPluginCommunity(plugin); | ||
}) | ||
.finally(() => setLoading(false)); | ||
}, []); | ||
|
||
if (loading) { | ||
return <IdentifyPluginLoader />; | ||
} | ||
|
||
if (!pluginCommunity) { | ||
return <ErrorIdentifyPlugin />; | ||
} | ||
|
||
|
||
return ( | ||
<div className="sticky top-[4rem] z-[50] mb-3 flex items-center gap-2 border-b border-solid border-zinc-900 bg-[#0f0f0f] bg-opacity-90 px-4 py-3 shadow-sm backdrop-blur-sm md:px-12"> | ||
<Fragment> | ||
<div className="sticky top-[4rem] z-[50] mb-3 flex items-center gap-2 border-b border-solid border-zinc-900 bg-[#0f0f0f] bg-opacity-90 px-4 py-3 shadow-sm backdrop-blur-sm md:px-12"> | ||
<Image | ||
className="grid h-9 w-9 min-w-[36px] place-items-center rounded-full bg-zinc-700" | ||
src={`https://raw.githubusercontent.com/BasedHardware/Friend/main/${pluginCommunity.image}`} | ||
src={`https://raw.githubusercontent.com/BasedHardware/Friend/main/${pluginCommunity?.image}`} | ||
alt={''} | ||
width={50} | ||
height={50} | ||
/> | ||
<div> | ||
<h3 className="text-base font-semibold md:text-base">{pluginCommunity.name}</h3> | ||
<h3 className="text-base font-semibold md:text-base">{pluginCommunity?.name}</h3> | ||
<p className="line-clamp-1 text-sm text-gray-500 md:text-base"> | ||
{pluginCommunity.description} | ||
</p> | ||
</div> | ||
</div> | ||
</Fragment> | ||
|
||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters