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

ODP-380 #620

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ export default function ApplicationSearch({
onSubmit={(e) => console.log(e)}
className="w-full px-8 xxl:px-0 max-w-8xl mx-auto"
>
<div className="w-full max-w-[819px] xxl:pl-8 2xl:px-0 ">
<h1 className="text-[40px] leading-[48px] font-acumin font-semibold text-white mb-[25px]">
Applications
</h1>
</div>
<div className="relative flex w-full max-w-[819px] items-start justify-start gap-x-6 xxl:pl-8 2xl:px-0">
<input
onChange={(e) => setQuery(e.target.value)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default function DatasetApplication({ application }: { application: Appli

return (
<section>
<div className="font-['Acumin Pro SemiCondensed'] text-2xl font-semibold text-black truncate whitespace-normal">
<div className="font-['Acumin Pro SemiCondensed'] text-2xl font-semibold text-black truncate whitespace-normal mb-6">
Datasets associated with {application.title ?? application.name}{' '}
{isLoading ? <Spinner /> : `(${data?.count})`}
</div>
Expand Down
92 changes: 43 additions & 49 deletions deployment/frontend/src/components/applications/Hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ import { Application, GroupTree, GroupsmDetails } from '@/schema/ckan.schema'
import Link from 'next/link'
import { useSession } from 'next-auth/react'
import { api } from '@/utils/api'
import {
ArrowTurnLeftUpIcon,
ArrowUpRightIcon,
} from '@heroicons/react/24/solid'

export function Hero({ application }: { application: Application }) {
const { data: session } = useSession()
Expand All @@ -23,71 +27,61 @@ export function Hero({ application }: { application: Application }) {
}`}
className="object-cover"
/>
<div className="absolute bottom-0 z-10 flex lg:h-[68px] lg:w-56 px-4 py-4 items-center justify-center rounded-t-[3px] bg-white">
<div className="absolute bottom-0 z-10 flex lg:h-[68px] lg:w-60 px-4 py-4 items-center justify-center rounded-t-[3px] bg-white">
<Link
href="/application"
className="inline-flex items-center justify-center ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 bg-amber-400 text-stone-900 font-bold font-acumin hover:bg-yellow-500 h-11 px-6 py-4 rounded-[3px] text-base"
className="whitespace-nowrap inline-flex items-center justify-center ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 bg-amber-400 text-stone-900 font-bold font-acumin hover:bg-yellow-500 h-11 px-6 py-4 rounded-[3px] text-base"
>
<ChevronLeftIcon className="mb-1 lg:mr-1 h-6 w-6" />
<span>See all applications</span>
</Link>
</div>
</div>
<div className="flex flex-col gap-y-1 px-4 py-6 lg:col-span-3">
<div className="flex flex-col justify-center gap-y-1 px-4 py-6 lg:col-span-3">
<div className="text-[33px] font-bold text-black">
{application.title}
</div>
<div className="max-w-[578.85px] text-lg font-light text-black">
{application?.description}
</div>
<p className="max-w-[578.85px] text-lg font-light text-black">
{application?.description}{' '}
<a
href={application.contact_url}
target="_blank"
rel="noreferrer"
className="underline "
>
Contact the {application.title ?? application.name} Team
</a>
</p>
<div className="flex items-center gap-3">
<div className="text-base font-light text-black">
{application.package_count} Dataset(s)
{application.package_count} associated dataset
{application.package_count > 1 ? 's' : ''}
</div>
</div>
<CopyLink />
<div className="flex items-center gap-3">
<Button className="mt-3">
<a
href={application.homepage_url}
target="_blank"
rel="noreferrer"
className="flex items-center gap-1"
>
Open Application{' '}
<ArrowUpRightIcon className="h-5 w-5" />
</a>
</Button>
<Button className="mt-3" variant="outline">
<a
href={application.help_url}
target="_blank"
rel="noreferrer"
className="flex items-center gap-1"
>
Visit Guide <ArrowUpRightIcon className="h-5 w-5" />
</a>
</Button>
</div>
</div>
</div>
)
}

function CopyLink() {
const [clicked, setClicked] = useState(false)
return (
<>
{!clicked ? (
<Button
onClick={async () => {
await navigator.clipboard.writeText(
window.location.href
)
setClicked(!clicked)
setTimeout(() => {
setClicked(false)
}, 3000)
}}
variant="outline"
className="mr-auto mt-3"
>
Share application
</Button>
) : (
<button
onClick={() => setClicked(!clicked)}
className="mt-3 flex h-auto max-w-[578px] gap-2 rounded-sm border border-amber-400 px-5 py-3"
>
<ClipboardDocumentIcon className="h-6 w-6 text-gray-800" />
<div className="max-w-[30rem]">
<p className="text-start text-sm font-semibold text-black">
Link copied to clipboard
</p>
<p className="text-start text-sm font-light">
Make sure that the users who you are sharing the
collection with, have permissions to see it.
</p>
</div>
</button>
)}
</>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ export async function getServerSideProps(
},
}
} catch (e) {
console.log('FAILED TO GET APP', e)
return {
props: {},
redirect: {
Expand Down
10 changes: 5 additions & 5 deletions deployment/frontend/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export default function Home(
{({ selected }) => (
<div
className={classNames(
'text-black text-2xl font-medium font-acumin',
'text-black text-2xl font-medium font-acumin cursor-pointer',
selected
? 'text-[#32864b] underline underline-offset-8'
: ''
Expand All @@ -188,7 +188,7 @@ export default function Home(
{({ selected }) => (
<div
className={classNames(
'text-black text-2xl font-medium font-acumin',
'text-black text-2xl font-medium font-acumin cursor-pointer',
selected
? 'text-[#32864b] underline underline-offset-8'
: ''
Expand Down Expand Up @@ -229,7 +229,7 @@ export default function Home(
{({ selected }) => (
<div
className={classNames(
'text-black text-2xl font-medium font-acumin',
'text-black text-2xl font-medium font-acumin cursor-pointer',
selected
? 'text-[#32864b] underline underline-offset-8'
: ''
Expand All @@ -243,7 +243,7 @@ export default function Home(
{({ selected }) => (
<div
className={classNames(
'text-black text-2xl font-medium font-acumin',
'text-black text-2xl font-medium font-acumin cursor-pointer',
selected
? 'text-[#32864b] underline underline-offset-8'
: ''
Expand All @@ -257,7 +257,7 @@ export default function Home(
{({ selected }) => (
<div
className={classNames(
'text-black text-2xl font-medium font-acumin',
'text-black text-2xl font-medium font-acumin cursor-pointer',
selected
? 'text-[#32864b] underline underline-offset-8'
: ''
Expand Down
1 change: 1 addition & 0 deletions deployment/frontend/src/schema/ckan.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ export type Application = Group & {
image_url: string
image_display_url: string
help_url: string
homepage_url: string
contact_url: string
packages?: Array<Dataset>
package_count: number
Expand Down
Loading