Skip to content

Commit

Permalink
Merge branch 'dev' into sync-dev-staging-jan-30
Browse files Browse the repository at this point in the history
  • Loading branch information
luccasmmg committed Jan 30, 2025
2 parents 883a173 + 1fd4416 commit c5cce96
Show file tree
Hide file tree
Showing 14 changed files with 140 additions and 95 deletions.
10 changes: 7 additions & 3 deletions deployment/frontend/src/components/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,18 @@ export default function Search({
<input
placeholder="Search data"
aria-label="search"
className="h-full block w-full border-0 px-5 py-2 text-[#4f4e4e] shadow-wri-small ring-1 ring-inset ring-gray-300 placeholder:text-[#4f4e4e] placeholder:font-light focus:bg-slate-100 focus:ring-0 focus:ring-offset-0 sm:text-sm sm:leading-6 rounded-tl-[3px] rounded-bl-[3px] border-r-0"
className="h-full placeholder:font-acumin block w-full border-0 px-5 py-2 text-[#4f4e4e] shadow-wri-small rounded-tr-[3px] rounded-br-[3px] placeholder:text-gray-900 placeholder:text-base focus:bg-slate-100 focus:ring-0 focus:ring-offset-0 sm:text-sm sm:leading-6 leading-[19.2px] rounded-tl-[3px] rounded-bl-[3px] border-r-0"
{...register('search')}
/>
<div className="absolute flex h-[54.392px] px-8 right-0 leading-[29.25px] text-black bg-wri-gold rounded-tr-[3px] rounded-br-[3px] border-l-0">
<div className="absolute flex h-[54.392px] px-8 right-0 leading-[29.25px] text-black bg-wri-gold rounded-tr-[3px] rounded-br-[3px] border-l-0 ">
{!isSearch ||
watch('search') !=
filters?.find((f) => f.key == 'search')?.value ? (
<button type="submit" aria-label="submit query" className='text-[21px] font-semibold font-acumin '>
<button
type="submit"
aria-label="submit query"
className="text-[21px] font-semibold font-acumin "
>
Search
</button>
) : (
Expand Down
6 changes: 2 additions & 4 deletions deployment/frontend/src/components/_shared/DownloadPopup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,8 @@ export function DownloadPopup({
/>
<label className="ml-2 text-sm text-gray-500">
Do you want to subscribe to
news and updates on the data
explorer? By checking this
news and updates on the Data
Explorer? By checking this
box you agree to receive
updates from WRI. You can
change your email
Expand Down Expand Up @@ -415,7 +415,6 @@ export function DownloadPopup({
value: c.iso,
})
)}
placeholder="Ex: USA"
maxWidth="w-full"
/>
<ErrorDisplay
Expand Down Expand Up @@ -650,7 +649,6 @@ export function DirectDownloadPopup({
value: c.iso,
})
)}
placeholder="Ex: USA"
maxWidth="w-full"
/>
</div>
Expand Down
5 changes: 3 additions & 2 deletions deployment/frontend/src/components/_shared/SimpleSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export interface Option<V> {

interface SimpleSelectProps<T extends FieldValues, V extends Object> {
options: PathValue<T, Path<T> & Option<V>>[]
placeholder: string
placeholder?: string
className?: string
maxWidth?: string
formObj?: UseFormReturn<T>
Expand Down Expand Up @@ -71,7 +71,8 @@ export default function SimpleSelect<T extends FieldValues, V extends Object>({
id={id}
className={classNames(
'relative text-left block w-full rounded-md border-0 px-5 py-3 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:border-b-2 focus:border-blue-800 focus:bg-slate-100 focus:ring-0 focus:ring-offset-0 sm:text-sm sm:leading-6',
className ?? ''
className ?? '',
!placeholder ? 'min-h-[2.5rem]' : ''
)}
>
<span
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,29 @@ export default function ApplicationSearch({
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">

<div className="relative flex w-full max-w-[819px] items-start justify-start gap-x-6 xxl:pl-8 2xl:px-0 h-[54.393px] ">
<input
onChange={(e) => setQuery(e.target.value)}
value={query}
name="search"
placeholder="Search applications"
placeholder={`Search applications`}
aria-label="search"
className="h-14 rounded-sm block w-full border-0 px-5 py-2 text-gray-900 shadow-wri-small ring-1 ring-inset ring-gray-300 placeholder:text-gray-900 placeholder:text-base border-b-2 border-blue-800 focus:bg-slate-100 focus:ring-0 focus:ring-offset-0 sm:text-sm sm:leading-6"
className="h-full block w-full border-0 px-5 py-2 text-[#000000] shadow-wri-small rounded-tr-[3px] rounded-br-[3px] placeholder:text-gray-900 placeholder:text-base focus:bg-slate-100 focus:ring-0 focus:ring-offset-0 sm:text-sm sm:leading-6 leading-[19.2px] rounded-tl-[3px] rounded-bl-[3px] border-r-0"
/>
{isLoading ? (
<Spinner className="absolute right-8 top-[1rem] h-5 w-5 text-wri-black" />
) : (
<button
type="submit"
aria-label="submit"
className=" my-auto"
>
<MagnifyingGlassIcon className="absolute right-8 top-[1rem] h-5 w-5 text-wri-black" />
</button>
)}
<div className="absolute flex h-[54.393px] px-8 right-0 leading-[29.25px] text-black bg-wri-gold rounded-tr-[3px] rounded-br-[3px]">
{isLoading ? (
<Spinner className="h-5 w-5 text-wri-black" />
) : (
<button
type="submit"
aria-label="submit"
className="text-[21px] font-semibold font-acumin "
>
Search
</button>
)}
</div>
</div>
</form>
</section>
Expand Down
2 changes: 1 addition & 1 deletion deployment/frontend/src/components/applications/Hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export function Hero({ application }: { application: Application }) {
/>
<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"
href="/applications"
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" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ function TopicsInner({
})
.flat()

function getTopicByName(topicName: string) {
return flattenedTopicHierarchy.find((topic) => topic.name === topicName)
}

function BuildHierarchy(
topic: TopicHierarchy,
level: number
Expand Down Expand Up @@ -188,7 +192,7 @@ function TopicsInner({
<Popover open={open} onOpenChange={setOpen}>
<PopoverTrigger asChild>
<Button
aria-label='topics button'
aria-label="topics button"
variant="outline"
role="combobox"
id="topicsButton"
Expand All @@ -207,7 +211,8 @@ function TopicsInner({
className="flex items-center gap-x-2 rounded-[3px] border border-blue-800 hover:bg-neutral-50 transition bg-white px-2 py-0.5"
>
<span className="font-['Acumin Pro SemiCondensed'] text-[15px] font-normal text-zinc-800">
{item}
{getTopicByName(item)?.title ??
item}
</span>
<DefaultTooltip content="Remove topic">
<XMarkIcon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export function OverviewForm({
register,
setValue,
watch,
getValues,
formState: { errors, defaultValues },
} = formObj

Expand Down Expand Up @@ -73,11 +74,19 @@ export function OverviewForm({
disabled={editing}
placeholder="name-of-dataset"
type="text"
className="pl-[5.9rem] sm:pl-[5.6rem] md:pl-[5.2rem] lg:pl-[5.4rem]"
className={`pl-[5.9rem] sm:pl-[5.6rem] md:pl-[5.2rem] lg:pl-[5.4rem] ${editing ? 'hidden' : ''} `}
>
<span className="absolute inset-y-0 left-5 flex items-center pr-3 sm:text-sm sm:leading-6">
/datasets/
</span>
{editing ? (
<input
disabled
value={`/datasets/${getValues('name') || ''}`}
className=" shadow-wri-small block w-full rounded-md border-0 px-5 py-3 text-gray-900 ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:border-b-2 focus:border-blue-800 disabled:bg-gray-100 focus:bg-slate-100 focus:ring-0 focus:ring-offset-0 sm:text-sm sm:leading-6 min-w-0 overflow-x-auto"
></input>
) : (
<span className="absolute inset-y-0 left-5 flex items-center pr-3 sm:text-sm sm:leading-6">
/datasets/
</span>
)}
</Input>
<ErrorDisplay name="name" errors={errors} />
</InputGroup>
Expand Down
19 changes: 12 additions & 7 deletions deployment/frontend/src/components/home/Hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export function Hero() {
) : (
<button
onClick={() => setIsOpen(true)}
className="px-3 py-2 tracking-wide rounded outline-wri-gold outline-1 outline text-sm font-semibold leading-6 text-white"
className="px-3 py-2 tracking-wide rounded outline-wri-gold outline-1 outline font-semibold leading-6 text-white"
id="nav-login-button"
>
Login
Expand All @@ -121,7 +121,7 @@ export function Hero() {
<Link
key={item.title}
href={item.href}
className="text-sm font-semibold leading-6 text-white"
className="font-semibold leading-6 text-white"
>
{item.title}
</Link>
Expand All @@ -132,7 +132,7 @@ export function Hero() {
) : (
<button
onClick={() => setIsOpen(true)}
className="px-3 py-2 tracking-wide rounded outline-wri-gold outline-1 outline text-sm font-semibold leading-6 text-white"
className="px-3 py-2 tracking-wide rounded outline-wri-gold outline-1 outline font-semibold leading-6 text-white"
>
Login
</button>
Expand Down Expand Up @@ -243,6 +243,9 @@ export function Hero() {
</p>
<form
onSubmit={handleSubmit((data) => {
if (data.search === '') {
return router.push('/search')
}
router.push({
pathname: '/search',
query: `search=%5B%7B%22title%22%3A%22Search%22%2C%22key%22%3A%22search%22%2C%22label%22%3A%22${encodeURIComponent(
Expand All @@ -257,14 +260,16 @@ export function Hero() {
<input
placeholder="Search datasets - try “energy”, “Global Forest Watch”, or “food”"
aria-label="search"
className="placeholder:text-[#5f5e5e] flex-shrink flex-grow placeholder:italic placeholder:font-light placeholder:leading-tight placeholder:sm:font-normal placeholder:sm:leading-normal text-[#4f4e4e] text-xs md:text-xl font-normal font-acumin w-full px-6 h-[66px] bg-white rounded-tl-[3px] rounded-bl-[3px] border-r-0"
className="placeholder:text-[#5f5e5e] flex-shrink flex-grow placeholder:italic placeholder:font-light placeholder:leading-tight placeholder:sm:font-normal placeholder:sm:leading-normal text-[#4f4e4e] text-xs md:text-xl font-normal font-acumin w-full px-6 h-[66px] bg-white rounded-tl-[3px] rounded-bl-[3px] border-y-0 border-r-0"
{...register('search')}
/>

<button
type="submit"
className="px-8 py-4 text-[26px] font-semibold font-acumin leading-[29.25px] text-black bg-wri-gold rounded-tr-[3px] rounded-br-[3px] h-[65px] w-full max-w-[149px] border-l-0"
>Search</button>
className="px-8 py-4 text-[26px] font-semibold font-acumin leading-[29.25px] text-black bg-wri-gold rounded-tr-[3px] rounded-br-[3px] h-[66px] w-full max-w-[149px] border-l-0 border-y-0"
>
Search
</button>
</div>
</form>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ export default function FilteredSearchLayout({
<>
<Disclosure.Button
aria-label="collapse sidebar"
className="absolute lg:block hidden left-[calc(25%-1.5rem)] top-[60vh] z-20"
className="absolute lg:block hidden left-[calc(25%-1.5rem)] md:top-[80vh] lg:top-[75vh] z-20"
>
<div
className={classNames(
Expand Down
Loading

0 comments on commit c5cce96

Please sign in to comment.