Skip to content
This repository was archived by the owner on Sep 30, 2025. It is now read-only.
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "jarvis",
"private": true,
"version": "0.9.7",
"version": "0.9.75",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"package": {
"productName": "Jarvis Client",
"version": "0.9.7"
"version": "0.9.75"
},
"tauri": {
"allowlist": {
Expand Down
18 changes: 18 additions & 0 deletions src/Icons/pack_1.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -321,3 +321,21 @@ export const IcoClose = ({ size = 24, color = "currentColor", className }: IconP
<path d="M16.8995 7L6.99998 16.8995" stroke={color} strokeWidth="2" strokeLinecap="round" />
</svg>
);

// Icon Pack: Phosphor Icons
// License: MIT - Copyright (c) 2023 Phosphor Icons
// Used in: Params View
export const IcoNotes = ({ size = 24, color = "currentColor", className }: IconProps) => (
<svg className={className} width={size} height={size} fill={color} viewBox="0 0 256 256">
<path d="M230.15,70.54,185.46,25.86a20,20,0,0,0-28.28,0L33.86,149.17A19.86,19.86,0,0,0,28,163.31V208a20,20,0,0,0,20,20H216a12,12,0,0,0,0-24H125L230.15,98.83A20,20,0,0,0,230.15,70.54ZM91,204H52V165l84-84,39,39ZM192,103,153,64l18.34-18.34,39,39Z">
</path>
</svg>
);

// Icon Pack: Phosphor Icons
// License: MIT - Copyright (c) 2023 Phosphor Icons
// Used in: Params View
export const IcoSave = ({ size = 24, color = "currentColor", className }: IconProps) => (
<svg className={className} width={size} height={size} fill={color} viewBox="0 0 256 256">
<path d="M222.14,77.17,178.83,33.86A19.86,19.86,0,0,0,164.69,28H48A20,20,0,0,0,28,48V208a20,20,0,0,0,20,20H208a20,20,0,0,0,20-20V91.31A19.86,19.86,0,0,0,222.14,77.17ZM164,204H92V156h72Zm40,0H188V152a20,20,0,0,0-20-20H88a20,20,0,0,0-20,20v52H52V52H163l41,41ZM164,80a12,12,0,0,1-12,12H96a12,12,0,0,1,0-24h56A12,12,0,0,1,164,80Z"></path></svg>
);
34 changes: 34 additions & 0 deletions src/Interfaces/IConfigFile.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
export interface ConfigFile {
"baseurl" : string | undefined
"username" : string | undefined
"apiToken" : string | undefined
"onboardState" : string | undefined
"openInBrowser" : boolean | undefined
"pinnedJobs" : string[] | undefined
"projectName" : string | undefined
"notificationSetJobs" : string[] | undefined
"projects" : string[] | undefined
"titlebarStyle" : "winStyle" | "macStyle" | "eggStyle" | undefined
"notificationPermission" : string | undefined
"notes": Notes[] | undefined
}

interface Notes {
[key: string]: {
[key: string]: string
}
}

export type allowedKeys =
"baseurl" |
"username" |
"apiToken" |
"onboardState" |
"openInBrowser" |
"pinnedJobs" |
"projectName" |
"notificationSetJobs" |
"projects" |
"titlebarStyle" |
"notificationPermission" |
"notes";
4 changes: 2 additions & 2 deletions src/components/JobCardComponent/JobCardComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ const JobCardComponent: React.FC<JobCardProps> = ({
{pinned && <IcoPinFilled className="inline-block ml-1" size={20} />}
{notification_set && <IcoBellFilled className="inline-block ml-1" size={20} />}
</div>
<div className="text-sm text-comment-color overflow-hidden line-clamp-2">
<p className="text-sm text-comment-color overflow-hidden line-clamp-2 break-all ">
{buildData.description}
</div>
</p>
</div>
</div>
);
Expand Down
141 changes: 123 additions & 18 deletions src/helpers/StorageManager.ts
Original file line number Diff line number Diff line change
@@ -1,41 +1,146 @@
import { BaseDirectory, createDir, exists, readTextFile, writeTextFile } from "@tauri-apps/api/fs";
import Logger from "./Logger";
import { ConfigFile, allowedKeys } from "@/Interfaces/IConfigFile";
import { CONFIG_FILE } from "@/config/constants";

type allowedKeys =
"baseurl" |
"username" |
"apiToken" |
"onboardState" |
"openInBrowser" |
"pinnedJobs" |
"projectName" |
"notificationSetJobs" |
"projects" |
"titlebarStyle" |
"notificationPermission";

/*
const saveToConfigFile = async (content: ConfigFile, CONFIG_FILE: string) => {
const saveToConfigFile = async (content: ConfigFile) => {
await writeTextFile(CONFIG_FILE, JSON.stringify(content), {
dir: BaseDirectory.AppData
});
};

const getConfigFile = async (CONFIG_FILE: string): Promise<ConfigFile> => {
const getConfigFile = async (): Promise<ConfigFile> => {
const appDataDirExists = await exists("", { dir: BaseDirectory.AppData });

if (!appDataDirExists) {
await createDir("", { dir: BaseDirectory.AppData });
}

if (await exists(CONFIG_FILE, { dir: BaseDirectory.AppData })) {
let content = await readTextFile(CONFIG_FILE, { dir: BaseDirectory.AppData });

// If the file is empty, return an empty object
if (content === "") return {} as ConfigFile;

// File exists, return it
return await JSON.parse(await readTextFile(CONFIG_FILE, { dir: BaseDirectory.AppData }));
return await JSON.parse(content);
} else {
// File doesnt exist, return empty object
return {} as ConfigFile;
}
};
*/

/**
* @classdesc A class to manage the storage of data in the browser.
* @note This is still a work in progress and will be adapated gradually.
*/
export const new_StorageManager = {
get: async (key: allowedKeys): Promise<ConfigFile[typeof key] | boolean> => {
try {
let configFile = await getConfigFile();

if (configFile[key] === undefined) return false;

return configFile[key];
} catch (error) {
Logger.error("helpers/StorageManager.ts", error);
return false;
}
},
save: async <K extends allowedKeys>(key: K, value: ConfigFile[K]): Promise<Boolean> => {
try {
let configFile = await getConfigFile();
configFile[key] = value;
await saveToConfigFile(configFile);

return true;
} catch (error) {
Logger.error("helpers/StorageManager.ts", error);
return false;
}
},
removeItem: async (key: allowedKeys): Promise<Boolean> => {
try {
let configFile = await getConfigFile();
delete configFile[key];
await saveToConfigFile(configFile);

return true;
} catch (error) {
Logger.error("helpers/StorageManager.ts", error);
return false;
}
},
clearAll: async (): Promise<Boolean> => {
try {
await saveToConfigFile({} as ConfigFile);
return true;
} catch (error) {
Logger.error("helpers/StorageManager.ts", error);
return false;
}
},
notes: {
get: async (project: string, job: string): Promise<string | undefined> => {
try {
const configFile = await getConfigFile();

if (configFile.notes) {
const projectNotes = configFile.notes.find((note) => note[project]);

if (projectNotes) {
return projectNotes[project][job];
}
}

return undefined;
} catch (error) {
Logger.error("helpers/StorageManager.ts", error);
return undefined;
}
},
save: async (project: string, job: string, note: string): Promise<boolean> => {
try {
const configFile = await getConfigFile();

// Ensure that the notes object and its nested properties are defined
if (!configFile.notes) {
configFile.notes = [];
Logger.debug("Empty notes array created")
}

const projectIndex = configFile.notes.findIndex((note) => Object.keys(note)[0] === project);
if (!configFile.notes[projectIndex] || configFile.notes[projectIndex] === undefined || projectIndex === -1) {
configFile.notes[projectIndex] = {};
Logger.debug("Empty project index created")
}

if (projectIndex < 0) {
configFile.notes.push({
[project]: {
[job]: note,
},
});
} else {
configFile.notes[projectIndex][project][job] = note;
}

Logger.debug("Saving note", configFile.notes);

await saveToConfigFile(configFile);

return true;
} catch (error) {
Logger.error("helpers/StorageManager.ts", error);
return false;
}
},


},
};



/**
* @classdesc A class to manage the storage of data in the browser.
Expand Down
34 changes: 17 additions & 17 deletions src/screens/Jarvis/Views/BuildView/BuildView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,23 +139,23 @@ const BuildView: React.FC<Props> = ({ parameterDefinition, buildData }) => {
<div key={index} className="mb-10">{getComponentForParameter(parameter)}</div>
))}

<div className="relative flex items-center h-[50px]">
<motion.button
initial={{ opacity: 1, y: 0 }}
animate={{ opacity: buildButtonDisabled ? 0 : 1, y: buildButtonDisabled ? -10 : 0 }}
onClick={buildButtonClick}
className="absolute h-[37px] text-[15px] text-white bg-[#3a5e4b] font-medium rounded-md text-comment-color px-3 active:bg-background-card-selected hover:brightness-[1.3]"
>
Start Build
</motion.button>
<motion.span
initial={{ opacity: 0, y: 10 }}
animate={{ opacity: buildButtonDisabled ? 1 : 0, y: buildButtonDisabled ? 0 : 10 }}
className="absolute pointer-events-none"
>
<span className="inline-flex items-center rounded-md bg-[#122a2d] px-2 py-1 text-xs font-medium text-green-300 ring-2 ring-inset ring-green-600/20">BUILD STARTED</span>
</motion.span>
</div>
<div className="relative flex items-center h-[50px]">
<motion.button
initial={{ opacity: 1, y: 0 }}
animate={{ opacity: buildButtonDisabled ? 0 : 1, y: buildButtonDisabled ? -10 : 0 }}
onClick={buildButtonClick}
className="absolute h-[37px] text-[15px] text-white bg-[#3a5e4b] font-medium rounded-md text-comment-color px-3 active:bg-background-card-selected hover:brightness-[1.3]"
>
Start Build
</motion.button>
<motion.span
initial={{ opacity: 0, y: 10 }}
animate={{ opacity: buildButtonDisabled ? 1 : 0, y: buildButtonDisabled ? 0 : 10 }}
className="absolute pointer-events-none"
>
<span className="inline-flex items-center rounded-md bg-[#122a2d] px-2 py-1 text-xs font-medium text-green-300 ring-2 ring-inset ring-green-600/20">BUILD STARTED</span>
</motion.span>
</div>

</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ interface Props {

const BooleanParameterValue: React.FC<Props> = ({ parameter }): React.JSX.Element => (
<div className="grid items-center">
<div className="flex items-center mr-2">
<IcoBool size={30} />
<div className="grid grid-cols-[30px_auto] mr-2">
<IcoBool size={30} className="mt-2"/>
<div className="ml-5">
<h1 className="text-2xl font-bold text-text-color">{parameter.name}</h1>
<p className="text-md text-comment-color">{parameter.description}</p>
Expand All @@ -23,7 +23,6 @@ const BooleanParameterValue: React.FC<Props> = ({ parameter }): React.JSX.Elemen
value={parameter.value ? "✔" : ""}
className="w-[30px] h-[30px] bg-property-background font-medium rounded-md text-comment-color px-2 mt-2 active:bg-property-background-selected hover:brightness-[1.3]"
/>

</div>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ interface Props {
}

const CredentialsParameterValue: React.FC<Props> = ({ parameter }): React.JSX.Element => (
<div className="grid items-center">
<div className="flex items-center mr-2">
<IcoPasskey size={30} />
<div className="grid items-center">
<div className="grid grid-cols-[30px_auto] mr-2">
<IcoPasskey size={30} className="mt-2"/>
<div className="ml-5">
<h1 className="text-2xl font-bold text-text-color">{parameter.name}</h1>
<p className="text-md text-comment-color">{parameter.description}</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ const FileParameterValue: React.FC<Props> = ({ parameter, buildNumber }): React.
};

return (
<div className="grid items-center">
<div className="flex items-center mr-2">
<IcoFile size={30} />
<div className="grid items-center">
<div className="grid grid-cols-[30px_auto] mr-2">
<IcoFile size={30} className="mt-2"/>
<div className="ml-5">
<h1 className="text-2xl font-bold text-text-color">{parameter.name}</h1>
<p className="text-md text-comment-color">{parameter.description}</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ interface Props {
}

const OtherParameterValue: React.FC<Props> = ({ parameter }): React.JSX.Element => (
<div className="grid items-center">
<div className="flex items-center mr-2">
<IcoQuestionmark size={30} />
<div className="grid items-center">
<div className="grid grid-cols-[30px_auto] mr-2">
<IcoQuestionmark size={30} className="mt-2"/>
<div className="ml-5">
<h1 className="text-2xl font-bold text-text-color">{parameter.name}</h1>
<p className="text-md text-comment-color">{parameter.description}</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ interface Props {
}

const PasswordParameterValue: React.FC<Props> = ({ parameter }): JSX.Element => (
<div className="grid items-center">
<div className="flex items-center mr-2">
<IcoPasskey size={30} />
<div className="grid items-center">
<div className="grid grid-cols-[30px_auto] mr-2">
<IcoPasskey size={30} className="mt-2"/>
<div className="ml-5">
<h1 className="text-2xl font-bold text-text-color">{parameter.name}</h1>
<p className="text-md text-comment-color">{parameter.description}</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ interface Props {
}

const StringParameterValue: React.FC<Props> = ({ parameter }): JSX.Element => (
<div className="grid items-center">
<div className="flex items-center mr-2">
<IcoText size={30} />
<div className="grid items-center">
<div className="grid grid-cols-[30px_auto] mr-2">
<IcoText size={30} className="mt-2"/>
<div className="ml-5">
<h1 className="text-2xl font-bold text-text-color">{parameter.name}</h1>
<p className="text-md text-comment-color">{parameter.description}</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ interface Props {
}

const TextParameterValue: React.FC<Props> = ({ parameter }): JSX.Element => (
<div className="grid items-center">
<div className="flex items-center mr-2">
<IcoQuote size={30} />
<div className="grid items-center">
<div className="grid grid-cols-[30px_auto] mr-2">
<IcoQuote size={30} className="mt-2"/>
<div className="ml-5">
<h1 className="text-2xl font-bold text-text-color">{parameter.name}</h1>
<p className="text-md text-comment-color">{parameter.description}</p>
Expand Down
Loading