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

Enable cmd/ctrl click open in a new tab. #23

Merged
merged 1 commit into from
Sep 3, 2024
Merged
Changes from all commits
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
150 changes: 70 additions & 80 deletions components/registry/RegistryCard.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Link from 'next/link'
import { useRouter } from 'next/router'
import React from 'react'
import { NodeVersion } from 'src/api/generated'
interface RegistryCard {
Expand All @@ -24,95 +23,86 @@ const RegistryCard: React.FC<RegistryCard> = ({
image,
rating,
downloads,
isLoggedIn,
}) => {
const router = useRouter()
const handleClick = () => {
if (!isLoggedIn) {
router.push(`/nodes/${id}`)
}
}

return (
<div
className="flex flex-col bg-gray-800 rounded-lg shadow cursor-pointer h-full dark:border-gray-700 lg:p-4"
onClick={handleClick}
>
<div>
{image && (
<img
className="object-cover w-20 h-20 rounded-3lg sm:rounded-lg"
src={image}
alt={`${name}'s Avatar`}
/>
)}
</div>
<a href={`nodes/${id}`}>
<div className="flex flex-col bg-gray-800 rounded-lg shadow cursor-pointer h-full dark:border-gray-700 lg:p-4">
<div>
{image && (
<img
className="object-cover w-20 h-20 rounded-3lg sm:rounded-lg"
src={image}
alt={`${name}'s Avatar`}
/>
)}
</div>

<div className="flex flex-col px-4">
<h6 className="mb-2 text-base font-bold tracking-tight text-white break-words">
{name}
</h6>
<div className="flex flex-col px-4">
<h6 className="mb-2 text-base font-bold tracking-tight text-white break-words">
{name}
</h6>

{latest_version && (
<p className="mb-1 text-xs tracking-tight text-white">
<span>v{latest_version.version}</span>
</p>
)}
<p className="mb-1 text-xs font-light text-white text-nowrap mt-2">
{publisherName}
</p>
<div className="flex items-center flex-start align-center gap-1 mt-2">
{downloads != 0 && (
<p className="flex justify-center text-center align-center">
<svg
className="w-4 h-4 text-white"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
fill="none"
viewBox="0 0 24 24"
>
<path
stroke="currentColor"
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M12 13V4M7 14H5a1 1 0 0 0-1 1v4a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-4a1 1 0 0 0-1-1h-2m-1-5-4 5-4-5m9 8h.01"
/>
</svg>
<p className="ml-1 text-xs font-bold text-white">
{downloads}
</p>
{latest_version && (
<p className="mb-1 text-xs tracking-tight text-white">
<span>v{latest_version.version}</span>
</p>
)}
<p className="mb-1 text-xs font-light text-white text-nowrap mt-2">
{publisherName}
</p>
<div className="flex items-center flex-start align-center gap-1 mt-2">
{downloads != 0 && (
<p className="flex justify-center text-center align-center">
<svg
className="w-4 h-4 text-white"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
fill="none"
viewBox="0 0 24 24"
>
<path
stroke="currentColor"
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M12 13V4M7 14H5a1 1 0 0 0-1 1v4a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-4a1 1 0 0 0-1-1h-2m-1-5-4 5-4-5m9 8h.01"
/>
</svg>
<p className="ml-1 text-xs font-bold text-white">
{downloads}
</p>
</p>
)}

{rating != 0 && (
<div className="flex justify-center text-center align-center">
<svg
className="w-4 h-4 text-white"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
fill="none"
viewBox="0 0 24 24"
>
<path
stroke="currentColor"
stroke-width="2"
d="M11.083 5.104c.35-.8 1.485-.8 1.834 0l1.752 4.022a1 1 0 0 0 .84.597l4.463.342c.9.069 1.255 1.2.556 1.771l-3.33 2.723a1 1 0 0 0-.337 1.016l1.03 4.119c.214.858-.71 1.552-1.474 1.106l-3.913-2.281a1 1 0 0 0-1.008 0L7.583 20.8c-.764.446-1.688-.248-1.474-1.106l1.03-4.119A1 1 0 0 0 6.8 14.56l-3.33-2.723c-.698-.571-.342-1.702.557-1.771l4.462-.342a1 1 0 0 0 .84-.597l1.753-4.022Z"
/>
</svg>
{rating != 0 && (
<div className="flex justify-center text-center align-center">
<svg
className="w-4 h-4 text-white"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
fill="none"
viewBox="0 0 24 24"
>
<path
stroke="currentColor"
stroke-width="2"
d="M11.083 5.104c.35-.8 1.485-.8 1.834 0l1.752 4.022a1 1 0 0 0 .84.597l4.463.342c.9.069 1.255 1.2.556 1.771l-3.33 2.723a1 1 0 0 0-.337 1.016l1.03 4.119c.214.858-.71 1.552-1.474 1.106l-3.913-2.281a1 1 0 0 0-1.008 0L7.583 20.8c-.764.446-1.688-.248-1.474-1.106l1.03-4.119A1 1 0 0 0 6.8 14.56l-3.33-2.723c-.698-.571-.342-1.702.557-1.771l4.462-.342a1 1 0 0 0 .84-.597l1.753-4.022Z"
/>
</svg>

<p className="ml-1 text-xs font-bold text-white">
{rating}
</p>
</div>
)}
<p className="ml-1 text-xs font-bold text-white">
{rating}
</p>
</div>
)}
</div>
</div>
</div>
</div>
</a>
)
}
export default RegistryCard
Loading