Skip to content

Dynamic TAK content from a Rune tool generated JSON file #33

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

Open
wants to merge 59 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
b65b432
Added class names to components for easier debugging (as part of http…
Sep 7, 2024
83aa045
Added readonly type definition to make it possible to use readonly va…
Sep 7, 2024
878632e
Removed useless use of useRef from few components (part of https://gi…
Sep 7, 2024
32c8e46
Improved types for Tak zip download components (for https://github.co…
Sep 7, 2024
284adbd
Added initial source code for tak usage manuals in rune YML format fo…
Sep 7, 2024
ce9a370
Added initial .gitignore for rune directory ( https://github.com/pvar…
Sep 7, 2024
f31ec68
Started using dynamic views to serve tak content for https://github.c…
Sep 7, 2024
dee7e50
Added ServiceView and related code for https://github.com/pvarki/rase…
Sep 7, 2024
a3426a6
Refactored to support new rune language format (see https://github.co…
Sep 7, 2024
2bc6ca6
Refactored to use new Rune i18n support for https://github.com/pvarki…
Sep 7, 2024
4e7477a
Added translations for tak content for https://github.com/pvarki/rase…
Sep 7, 2024
9fe073e
Added rune output in the git so no need to rebuild initially for http…
Sep 7, 2024
bee2827
Reverted back to original style for HTML inside the translation ( htt…
Sep 7, 2024
722a5c2
Added some test helpers for https://github.com/pvarki/rasenmaeher-ui/…
Sep 8, 2024
91de9ca
Refactored to support reuable custom Rune components for https://gith…
Sep 8, 2024
c68cb97
Changed to use ServiceTakUsageCard as custom component in YAML for ht…
Sep 8, 2024
f7779c2
Implemented support for custom YAML content components for https://gi…
Sep 8, 2024
14cde32
Changed content expiration time to 1 second for dev mode builds
Nov 15, 2024
0284ff7
Added end of line
Nov 15, 2024
1ea5efc
Refactored to use newer Rune implementation https://github.com/pvarki…
Nov 22, 2024
9e3e32b
Exported props to use with Rune renderer implementation for https://g…
Nov 22, 2024
07ef16e
Changed title type to be more flexible, in order to be used with Rune…
Nov 22, 2024
9b208d2
Refactored android usage page 1 for Rune https://github.com/pvarki/ra…
Nov 22, 2024
78003b5
Refactored to HTML format https://github.com/pvarki/rasenmaeher-ui/is…
Nov 22, 2024
940ad32
Converted to HTML https://github.com/pvarki/rasenmaeher-ui/issues/43
Nov 22, 2024
6fba08a
Implemented support for component parameters in class attribute for h…
Nov 22, 2024
97754c0
Saved some changes
Jan 25, 2025
44bea2f
Implemented markdown support https://github.com/hyperifyio/rune/issue…
Jan 25, 2025
470c376
Moved tak files to its own sub folder
Jan 25, 2025
5fbc08b
Added support for livelog user guide
Jan 25, 2025
b208306
Added livelog user guide
Jan 25, 2025
5492def
Added livelog user guide
Jan 25, 2025
d0debb5
Added missing html types for Markdown support in the dynamic user gui…
Jan 25, 2025
7f0ee7d
Added livelog user guide
Jan 25, 2025
b2586e2
Working towards dynamic product documentation
Jan 26, 2025
c9e9593
Fixed some TSX to HTML
Jan 26, 2025
e6555ad
Fixed tak HTML documentation files
Jan 27, 2025
25d96ac
Synced translations
Jan 27, 2025
28e91e7
Fixed tak usage HTML documents
Jan 27, 2025
8f57cf0
Added updated tak.json
Jan 27, 2025
c1ae58c
Removed unused wrappers
Jan 27, 2025
3921b4a
Fixed Rune implementation
Jan 28, 2025
180aa6a
Fixed code blocks from rune content
Jan 29, 2025
8336f93
Fixed issue where the buttons margin top make it impossible to open t…
thejhh Mar 28, 2025
ba129bd
Updated translations
thejhh Mar 28, 2025
e490e1f
Fixed HTML formating and some content
thejhh Mar 28, 2025
ec870c8
Fixed issues with Tak help
thejhh Mar 28, 2025
9c83b4c
Added exclusion for class which is used in the tak user guide
thejhh Mar 28, 2025
26e21df
Configured Tailwind CSS safelist for all classes we detected from TAK…
thejhh Mar 29, 2025
655d2a9
Refactored rune products to build from their own repository
thejhh Mar 29, 2025
980d674
Fixed a type error
thejhh Mar 29, 2025
11e5af0
Removed rune from product list
thejhh Mar 29, 2025
627b054
Preparing for async loading of rune content, including translations
thejhh Mar 29, 2025
e3035ce
Initial dynamic loading support added
thejhh Mar 29, 2025
d647848
Implemented retry for failed products
thejhh Mar 30, 2025
665ed90
Improved error messages for incorrect content
thejhh Mar 30, 2025
722f9b3
Removed static product data
thejhh Mar 30, 2025
509aaae
Created better error messages
thejhh Mar 30, 2025
3f2bec6
Improved product content loading over API
thejhh Mar 30, 2025
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
28 changes: 26 additions & 2 deletions src/Router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { NotFoundView } from "./views/NotFoundView";
import { MtlsCreateView } from "./views/mtls/MtlsCreateView";
import { AdminRouteWrapper } from "./AdminRoutes";
import { UserRouteWrapper } from "./UserRoutes";
import { TakRouteWrapper } from "./TakRoutes";
import { ServiceRouteWrapper } from "./ServiceRoutes";

const router = createBrowserRouter([
{
Expand Down Expand Up @@ -75,7 +75,31 @@ const router = createBrowserRouter([
requireAuthType="mtls"
allowedUserTypes={["user", "admin"]}
>
<TakRouteWrapper />
<ServiceRouteWrapper serviceName={'tak'} />
</ProtectedRoute>
),
},
{
path: "/app/services/livelog/*",
element: (
<ProtectedRoute
requireValidUser={true}
requireAuthType="mtls"
allowedUserTypes={["user", "admin"]}
>
<ServiceRouteWrapper serviceName={'livelog'} />
</ProtectedRoute>
),
},
{
path: "/app/services/rune/*",
element: (
<ProtectedRoute
requireValidUser={true}
requireAuthType="mtls"
allowedUserTypes={["user", "admin"]}
>
<ServiceRouteWrapper serviceName={'rune'} />
</ProtectedRoute>
),
},
Expand Down
36 changes: 36 additions & 0 deletions src/ServiceRoutes.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { useTranslation } from "react-i18next";
import { Routes, Route } from "react-router-dom";
import LoadingComponent from "./components/Loading/LoadingComponent";
import { useDownloadTakZipModal } from "./components/tak/DownloadTakZipModal";
import { ContentService } from "./views/products/ContentService";
import { ServiceView } from "./views/products/ServiceView";

export function ServiceRouteWrapper( props: { serviceName : string }) {
const serviceName = props.serviceName;
const contentService = ContentService.getProductContentService(serviceName);
const viewNames = contentService ? contentService.getAllViewNames() : [];
const { t } = useTranslation();
const { openDownloadModal, loading } = useDownloadTakZipModal();
if (loading) {
return <LoadingComponent text={t("takZipDownload.iAmDownloading")} />;
}
const handleDownloadButtonClick = () => {
(openDownloadModal as () => void)();
};
return (
<Routes>{viewNames.map(
(viewName: string, index: number) => {
const view = contentService?.getView(viewName);
const path : string = view?.path ?? viewName;
return <Route key={index} path={path} element={
<ServiceView
serviceName={serviceName}
viewName={viewName}
actions={{
'downloadZip': handleDownloadButtonClick,
}}
/>
} />;
})}</Routes>
);
}
160 changes: 0 additions & 160 deletions src/TakRoutes.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion src/components/CardsContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ interface CardsContainerProps {

export function CardsContainer({ children }: CardsContainerProps) {
return (
<div className="flex flex-col items-center justify-center mx-2 h-[calc(100vh - 4rem)] md:px-[20%] lg:px-[32%]">
<div className="cards-container flex flex-col items-center justify-center mx-2 h-[calc(100vh - 4rem)] md:px-[20%] lg:px-[32%]">
{children}
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/DropdownMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ interface DropdownItem {

interface DropdownMenuProps {
triggerLabel: string;
items: DropdownItem[];
items: readonly DropdownItem[];
onSelect: (value: string) => void;
contentStyle?: string;
triggerStyle?: string;
Expand Down
16 changes: 11 additions & 5 deletions src/components/FoldableCard.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
import React, { useState, useRef } from "react";
import React, {
useState,
useRef,
ReactNode,
} from "react";
import { useTranslation } from "react-i18next";

interface FoldableCardProps {
title: string;
title: string | ReactNode;
imageSrc?: string;
children?: React.ReactNode;
}

export function FoldableCard({ title, imageSrc, children }: FoldableCardProps) {
const { t } = useTranslation(["common", "dynamic"]);
const [isOpen, setIsOpen] = useState(false);
const bottomRef = useRef<HTMLDivElement>(null);

Expand All @@ -32,19 +38,19 @@ export function FoldableCard({ title, imageSrc, children }: FoldableCardProps) {

return (
<div
className="relative flex flex-col w-full p-0 rounded-md cursor-pointer m-2 bg-backgroundLight"
className="foldable-card relative flex flex-col w-full p-0 rounded-md cursor-pointer m-2 bg-backgroundLight"
onClick={handleClick}
>
{!isOpen && imageSrc && (
<img
src={imageSrc}
alt={title}
alt={typeof title === 'string' ? title : 'product image'}
className="w-16 h-16 object-contain self-center mt-2 mb-2"
/>
)}

<div className="absolute top-0 right-0 flex items-center space-x-2 bg-primary p-2 rounded-tl-lg">
<h3 className="text-l text-white">{title}</h3>
<h3 className="text-l text-white">{typeof title === 'string' ? t(title) : title}</h3>
<span
className={`transform transition-transform duration-300 text-white ${
isOpen ? "rotate-180" : ""
Expand Down
7 changes: 4 additions & 3 deletions src/components/NavigateButtons.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@

import { useState } from "react";
import { useNavigate } from "react-router-dom";
import { Button } from "./Button";
import { useTranslation } from "react-i18next";

interface NavigateButtonsProps {
export interface NavigateButtonsProps {
backUrl: string;
forwardUrl: string;
alterBack?: string;
Expand Down Expand Up @@ -36,7 +37,7 @@ export function NavigateButtons({
return (
<div style={{ marginTop: "95px" }}>
<div className="fixed bottom-2 left-0 right-0 flex justify-center">
<section className="items-start rounded bg-zinc-800 flex rounded-lg max-w min-h-[105px] max-w-full gap-2.5 mt-24 p-2.5 max-md:justify-center">
<section className="items-start rounded bg-zinc-800 flex rounded-lg max-w min-h-[105px] max-w-full gap-2.5 p-2.5 max-md:justify-center">
<Button
styling={`transform transition-transform duration-200 justify-center items-center rounded ${
backClicked ? "scale-95" : "scale-100"
Expand All @@ -60,7 +61,7 @@ export function NavigateButtons({
onPointerUp={() => setContinueClicked(false)}
onClick={handleContinueClick}
>
{alterForward || t("navigateButtons.continue")}
{alterForward ? t(alterForward) : t("navigateButtons.continue")}
</Button>
</section>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/ServiceInfoCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export function ServiceInfoCard({
children,
}: ServiceInfoCardProps) {
return (
<div className="flex flex-col items-center justify-center bg-backgroundLight rounded-lg w-full p-2 mb-2 overflow-hidden">
<div className="service-info-card flex flex-col items-center justify-center bg-backgroundLight rounded-lg w-full p-2 mb-2 overflow-hidden">
{title && (
<h3 className="text-white text-xl font-bold mt-1 mb-1">{title}</h3>
)}
Expand Down
6 changes: 4 additions & 2 deletions src/components/StatusBar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
interface StatusBarProps {
title: string;
import { ReactNode } from "react";

export interface StatusBarProps {
title: ReactNode;
progressMax: number;
progressNow: number;
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/UnfoldableCard2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Step, StepProps } from "./Step";

interface UnfoldableCardProps {
title: React.ReactNode;
steps?: StepProps[];
steps?: readonly StepProps[];
content?: React.ReactNode;
children?: React.ReactNode;
styling?: string;
Expand All @@ -26,7 +26,7 @@ export function UnfoldableCard({

return (
<div
className={`flex flex-col w-full p-4 rounded-md cursor-pointer bg-background ${styling}`}
className={`unfoldable-card-2 flex flex-col w-full p-4 rounded-md cursor-pointer bg-background ${styling}`}
onClick={handleClick}
>
<div className="flex justify-between items-center">
Expand Down
Loading
Loading