Skip to content
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
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 30 additions & 16 deletions packages/kiosk-ui/src/components/main-page/application-card.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { CheckCircle, ExternalLink } from 'lucide-react';
import { ExternalLink } from 'lucide-react';
import { Card, CardContent } from '@/components/ui/card';
import classNames from 'classnames';
import { cn } from '@/lib/utils';

interface ApplicationCardProps {
disable?: boolean;
icon: string;
iconAlt: string;
title: string;
Expand All @@ -15,16 +16,32 @@ interface ApplicationCardProps {
shadowColor?: string;
}

export function ApplicationCard({ icon, iconAlt, title, subtitle, description, iconBgColor, checkColor, link, shadowColor }: ApplicationCardProps) {
export function ApplicationCard({
icon,
iconAlt,
title,
subtitle,
description,
iconBgColor,
checkColor,
link,
shadowColor,
disable,
}: ApplicationCardProps) {
// Use a stronger shadow in dark mode, but keep it subtle
const darkShadow = shadowColor ? shadowColor.replace(/0\.15\)/, '0.35)') : undefined;
const isDark = typeof window !== 'undefined' && window.matchMedia('(prefers-color-scheme: dark)').matches;
const appliedShadow = shadowColor ? (isDark ? darkShadow : shadowColor) : undefined;

const isDisabled = !!disable;

const content = (
<Card
className={cn(
classNames('border rounded-xl transition-shadow duration-200', { 'hover:shadow-lg hover:-translate-y-1 hover:border-primary/30': link })
classNames('border rounded-xl transition-shadow duration-200', {
'hover:shadow-lg hover:-translate-y-1 hover:border-primary/30': link && !isDisabled,
'pointer-events-none': isDisabled,
})
)}
style={{
boxShadow: appliedShadow ? `0 2px 16px 0 ${appliedShadow}` : undefined,
Expand All @@ -43,22 +60,19 @@ export function ApplicationCard({ icon, iconAlt, title, subtitle, description, i
<p className="text-xs text-muted-foreground leading-tight">{subtitle}</p>
<p className="text-xs text-muted-foreground leading-tight">{description}</p>
</div>
{/* Use ExternalLink icon if clickable, else CheckCircle */}
{link ? (
<ExternalLink className={cn('h-4 w-4 flex-shrink-0', checkColor)} />
) : (
<CheckCircle className={cn('h-4 w-4 flex-shrink-0', checkColor)} />
)}
{/* Show icon only if not disabled and link exists, else nothing */}
{link && !isDisabled ? <ExternalLink className={cn('h-4 w-4 flex-shrink-0', checkColor)} /> : null}
</div>
</CardContent>
</Card>
);

return link ? (
<a href={link} target="_blank" rel="noopener noreferrer" className="block">
{content}
</a>
) : (
content
);
if (link && !isDisabled) {
return (
<a href={link} target="_blank" rel="noopener noreferrer" className="block">
{content}
</a>
);
}
return content;
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export function SupportedApplications() {

{/* QGIS Card */}
<ApplicationCard
disable={!guides?.enabled} // Disable if guides are not enabled
icon={QGISLogo}
iconAlt={t('applications.qgis.alt')}
title={t('applications.qgis.title')}
Expand All @@ -27,6 +28,7 @@ export function SupportedApplications() {

{/* ArcGIS Pro Card */}
<ApplicationCard
disable={!guides?.enabled} // Disable if guides are not enabled
icon={ArcGISLogo}
iconAlt={t('applications.arcgis.alt')}
title={t('applications.arcgis.title')}
Expand Down
15 changes: 11 additions & 4 deletions packages/kiosk-ui/src/types/openapi.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ export interface components {
qgis: string;
/** @description Link to ArcGIS Pro documentation */
arcgis: string;
/** @description Whether the guides are enabled */
enabled: boolean;
};
/**
* @description Type of file to retrieve (qlr for QGIS, lyrx for ArcGIS Pro)
Expand Down Expand Up @@ -303,8 +305,13 @@ export interface operations {
[name: string]: unknown;
};
content: {
'application/xml': string;
'application/json': string;
'application/json':
| {
[key: string]: unknown;
}
| string
| Record<string, never>;
'application/xml': string | Record<string, never>;
};
};
/** @description Unauthorized - No valid token */
Expand All @@ -316,8 +323,8 @@ export interface operations {
'application/json': components['schemas']['error'];
};
};
/** @description Not Found - QLR file not available */
404: {
/** @description Forbidden - User is banned */
403: {
headers: {
[name: string]: unknown;
};
Expand Down
4 changes: 4 additions & 0 deletions packages/token-kiosk/openapi3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ components:
required:
- qgis
- arcgis
- enabled
type: object
properties:
qgis:
Expand All @@ -238,6 +239,9 @@ components:
arcgis:
type: string
description: Link to ArcGIS Pro documentation
enabled:
type: boolean
description: Whether the guides are enabled
fileTypes:
type: string
enum: [qlr, lyrx]
Expand Down
2 changes: 1 addition & 1 deletion packages/token-kiosk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"@map-colonies/js-logger": "^2.0.0",
"@map-colonies/openapi-express-viewer": "^4.0.0",
"@map-colonies/read-pkg": "^1.0.0",
"@map-colonies/schemas": "^1.12.1",
"@map-colonies/schemas": "^1.12.2",
"@map-colonies/telemetry": "^10.0.1",
"@opentelemetry/api": "^1.9.0",
"async-cache-dedupe": "^2.2.0",
Expand Down
15 changes: 11 additions & 4 deletions packages/token-kiosk/src/openapi.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ export type components = {
qgis: string;
/** @description Link to ArcGIS Pro documentation */
arcgis: string;
/** @description Whether the guides are enabled */
enabled: boolean;
};
/**
* @description Type of file to retrieve (qlr for QGIS, lyrx for ArcGIS Pro)
Expand Down Expand Up @@ -300,8 +302,13 @@ export interface operations {
[name: string]: unknown;
};
content: {
'application/xml': string;
'application/json': string;
'application/json':
| {
[key: string]: unknown;
}
| string
| Record<string, never>;
'application/xml': string | Record<string, never>;
};
};
/** @description Unauthorized - No valid token */
Expand All @@ -313,8 +320,8 @@ export interface operations {
'application/json': components['schemas']['error'];
};
};
/** @description Not Found - QLR file not available */
404: {
/** @description Forbidden - User is banned */
403: {
headers: {
[name: string]: unknown;
};
Expand Down
1 change: 1 addition & 0 deletions packages/token-kiosk/tests/guides/guides.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ describe('guides', function () {
expect(res.body).toEqual({
qgis: 'https://example.com/qgis-guide',
arcgis: 'https://example.com/arcgis-guide',
enabled: true,
});
});
});
Expand Down
Loading