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

max height to legend #115

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
Binary file added client/cypress/downloads/downloads.html
Binary file not shown.
2 changes: 1 addition & 1 deletion client/cypress/e2e/filters.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ describe('Filter selection and removal URL update', () => {
const filterToRemove = selectedFilters[0];
cy.get(
`[data-cy="filters-remove-badge-${filterToRemove.category}-${filterToRemove.id}"]`
).click();
).click({ force: true });

// Verify the URL no longer includes the removed filter
cy.url().then((url) => {
Expand Down
6 changes: 3 additions & 3 deletions client/src/components/ui/dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const DialogOverlay = React.forwardRef<
<DialogPrimitive.Overlay
ref={ref}
className={cn(
'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 left-0 top-0 z-50 h-screen w-screen bg-black/40',
'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 left-0 top-0 z-50 h-screen w-screen bg-black/40 bg-gray-900 bg-opacity-70',
className
)}
{...props}
Expand All @@ -36,9 +36,9 @@ DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
const DialogContent = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> & { overlay?: boolean }
>(({ className, overlay = false, children, ...props }, ref) => (
>(({ className, children, ...props }, ref) => (
<DialogPortal>
{overlay && <DialogOverlay />}
{<DialogOverlay />}
<DialogPrimitive.Content
ref={ref}
className={cn(
Expand Down
9 changes: 6 additions & 3 deletions client/src/containers/charts/bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,13 @@ const CustomTooltip = ({
if (!active || !payload || !payload.length) return null;
return (
<div className="shadow-tooltip bg-gradient-tooltip m-auto rounded-md border p-2">
<p className="text-center">{label}</p>
<div className="flex space-x-2">
<p>Total</p>
<p>{payload[0].value}</p>
<p>Value</p>
<p className="font-bold">{payload[0].value}</p>
</div>
<div className="flex space-x-2">
<p>Year:</p>
<p className="font-bold">{label}</p>
</div>
</div>
);
Expand Down
31 changes: 25 additions & 6 deletions client/src/containers/charts/single-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,23 @@ export default function SingleBar({

<TooltipContent side="top" align="end">
<div className="flex flex-col items-center p-2 text-base">
<p>{formatCompactNumber(data['value'].afoco_funding || 0)}</p>
<p>
{((data['value'].afoco_funding * 100) / data['value'].total_funding).toFixed()}%
Funding:
<span className="font-bold">
{' '}
{formatCompactNumber(data['value'].afoco_funding || 0)}
</span>
<span>
{' '}
({((data['value'].afoco_funding * 100) / data['value'].total_funding).toFixed()}
%)
</span>
</p>
</div>
</TooltipContent>
</Tooltip>

<Tooltip>
<Tooltip delayDuration={0}>
<TooltipTrigger asChild>
<div
className="h-full cursor-pointer rounded-br-[4px] rounded-tr-[4px] bg-[#FFCC73] hover:border-2 hover:border-[#D48D00]"
Expand All @@ -53,10 +61,21 @@ export default function SingleBar({
</TooltipTrigger>
<TooltipContent side="top" align="end">
<div className="flex flex-col items-center p-2 text-base">
<p>{formatCompactNumber(data['value'].national_funding || 0)}</p>
<p>
{((data['value'].national_funding * 100) / data['value'].total_funding).toFixed()}
%
Funding:
<span className="font-bold">
{' '}
{formatCompactNumber(data['value'].national_funding || 0)}
</span>
<span>
{' '}
(
{(
(data['value'].national_funding * 100) /
data['value'].total_funding
).toFixed()}
%)
</span>
</p>
</div>
</TooltipContent>
Expand Down
10 changes: 5 additions & 5 deletions client/src/containers/countries/detail/panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -266,14 +266,14 @@ export default function CountryDetailPanel() {

<div className="flex flex-col space-y-2">
<div className="w-full rounded-xl bg-white p-4 shadow-sm">
<div className="flex items-center justify-between">
<div className="relative flex items-center justify-between">
<h3 className="text-base text-green-800">
Total funding{' '}
{indicators.country_funding.unit && (
<span>({indicators.country_funding.unit})</span>
)}
</h3>
<Tooltip>
<Tooltip delayDuration={200}>
<TooltipTrigger className="flex items-center justify-center rounded-full p-2 hover:bg-yellow-50 data-[state=open]:bg-yellow-50">
<Info className="text-green-800" size={20} />
</TooltipTrigger>
Expand All @@ -296,7 +296,7 @@ export default function CountryDetailPanel() {
<div className="w-full rounded-xl bg-white p-4 shadow-sm">
<div className="flex items-center justify-between pb-2">
<h3 className="text-base text-green-800">Total intervention area</h3>
<Tooltip>
<Tooltip delayDuration={200}>
<TooltipTrigger className="flex items-center justify-center rounded-full p-2 hover:bg-yellow-50 data-[state=open]:bg-yellow-50">
<Info className="text-green-800" size={20} />
</TooltipTrigger>
Expand Down Expand Up @@ -351,7 +351,7 @@ export default function CountryDetailPanel() {
<div className="w-full rounded-xl bg-white p-4 shadow-sm">
<div className="flex items-center justify-between pb-2">
<h3 className="text-base text-green-800">Total beneficiaries</h3>
<Tooltip>
<Tooltip delayDuration={200}>
<TooltipTrigger className="flex items-center justify-center rounded-full p-2 hover:bg-yellow-50 data-[state=open]:bg-yellow-50">
<Info className="text-green-800" size={20} />
</TooltipTrigger>
Expand Down Expand Up @@ -396,7 +396,7 @@ export default function CountryDetailPanel() {
<div className="w-full rounded-xl bg-white p-4 shadow-sm">
<div className="flex items-center justify-between pb-2">
<h3 className="text-base text-green-800">Total jobs</h3>
<Tooltip>
<Tooltip delayDuration={200}>
<TooltipTrigger className="flex items-center justify-center rounded-full p-2 hover:bg-yellow-50 data-[state=open]:bg-yellow-50">
<Info className="text-green-800" size={20} />
</TooltipTrigger>
Expand Down
2 changes: 1 addition & 1 deletion client/src/containers/filters/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default function Filters({ nrResults = 0 }: { nrResults: number }) {
</Button>
</DialogTrigger>

<DialogContent>
<DialogContent overlay>
<DialogHeader className="text-xl font-semibold leading-7 text-green-900">
<DialogTitle>Filters</DialogTitle>
</DialogHeader>
Expand Down
39 changes: 23 additions & 16 deletions client/src/containers/map/legend/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import MapLegendItem from '@/containers/map/legend/legend-item';

import Legend from '@/components/map/legend';
import { Button } from '@/components/ui/button';
import { ScrollArea } from '@/components/ui/scroll-area';

const MapLegends = ({ className = '' }) => {
const [layers] = useSyncLayers();
Expand All @@ -35,22 +36,28 @@ const MapLegends = ({ className = '' }) => {
return (
<div className="absolute bottom-12 right-6 z-10 flex w-full max-w-xs space-x-2">
{openLegend && (
<Legend
className={cn(
'animate-in fade-in-50 max-h-[calc(100vh_-_theme(space.16)_-_theme(space.6)_-_theme(space.48))] duration-300',
className
)}
sortable={{
enabled: sortable,
handle: true,
}}
onChangeOrder={handleChangeOrder}
>
{layers.map((layer) => {
const settings = { opacity: layer.opacity, visibility: layer.visibility, id: layer.id };
return <MapLegendItem key={layer.id} settings={settings} />;
})}
</Legend>
<ScrollArea className="flex h-72 w-full max-w-xs flex-col xl:h-full">
<Legend
className={cn(
'animate-in fade-in-50 max-h-[calc(100vh_-_theme(space.16)_-_theme(space.6)_-_theme(space.48))] duration-300',
className
)}
sortable={{
enabled: sortable,
handle: true,
}}
onChangeOrder={handleChangeOrder}
>
{layers.map((layer) => {
const settings = {
opacity: layer.opacity,
visibility: layer.visibility,
id: layer.id,
};
return <MapLegendItem key={layer.id} settings={settings} />;
})}
</Legend>
</ScrollArea>
)}
{layers.length > 0 && (
<Button
Expand Down
Loading