Skip to content

Commit

Permalink
Merge pull request #43 from pitzzahh/fix/deps-investigation
Browse files Browse the repository at this point in the history
[Fix]: False positive virus
  • Loading branch information
pitzzahh authored Dec 12, 2024
2 parents e0e5f87 + 17d0306 commit 3f7d191
Show file tree
Hide file tree
Showing 31 changed files with 492 additions and 218 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Deploy to GitHub Pages

on:
push:
branches: "main"
pull_request:
branches: "*"

jobs:
build_site:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2

# If you're using pnpm, add this step then change the commands and cache key below to use `pnpm`
# - name: Install pnpm
# uses: pnpm/action-setup@v2
# with:
# version: 8

- name: Install dependencies
run: bun install

- name: build
env:
BASE_PATH: "/heda"
run: |
bun run build
touch build/.nojekyll
- name: Upload Artifacts
uses: actions/upload-pages-artifact@v3
with:
# this should match the `pages` option in your adapter-static options
path: "build/"

deploy:
needs: build_site
runs-on: ubuntu-latest

permissions:
pages: write
id-token: write

environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

steps:
- name: Deploy
id: deployment
uses: actions/deploy-pages@v4
Binary file modified bun.lockb
Binary file not shown.
10 changes: 10 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://"0.0.9"keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.1.15] - 2024-12-12

## Add

- Alert in form when circuit number is already taken by a panel/load.

## Fix

- Fix remove load context menu state on heirarchy.

## [0.1.14] - 2024-12-12

## Fix
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "heda",
"version": "0.1.14",
"version": "0.1.15",
"type": "module",
"private": true,
"author": {
Expand All @@ -21,13 +21,13 @@
"devDependencies": {
"@sveltejs/adapter-auto": "^3.3.1",
"@sveltejs/adapter-static": "^3.0.6",
"@sveltejs/kit": "^2.9.1",
"@sveltejs/kit": "^2.10.1",
"@sveltejs/vite-plugin-svelte": "^5.0.1",
"@tailwindcss/typography": "^0.5.15",
"@tauri-apps/cli": "^2.1.0",
"@types/eslint": "^9.6.1",
"autoprefixer": "^10.4.20",
"bits-ui": "^1.0.0-next.69",
"bits-ui": "^1.0.0-next.71",
"clsx": "^2.1.1",
"eslint": "^9.16.0",
"eslint-config-prettier": "^9.1.0",
Expand All @@ -37,7 +37,7 @@
"prettier": "^3.4.2",
"prettier-plugin-svelte": "^3.3.2",
"prettier-plugin-tailwindcss": "^0.6.9",
"svelte": "^5.10.0",
"svelte": "^5.11.2",
"svelte-check": "^4.1.1",
"svelte-radix": "^2.0.1",
"svelte-sonner": "^0.3.28",
Expand All @@ -60,6 +60,6 @@
"rxdb": "^15.39.0",
"rxjs": "^7.8.1",
"sveltekit-superforms": "^2.21.1",
"zod": "^3.23.8"
"zod": "v3.23.8"
}
}
9 changes: 7 additions & 2 deletions src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
"productName": "Hierarchical Electrical Design Analyzer",
"version": "0.1.14",
"version": "0.1.15",
"identifier": "me.araopj.heda",
"build": {
"frontendDist": "../build",
Expand All @@ -12,7 +12,7 @@
"app": {
"windows": [
{
"title": "Hierarchical Electrical Design Analyzer",
"title": "Hierarchical Electrical Design Analyzer v0.1.14",
"width": 800,
"height": 600,
"minWidth": 800,
Expand All @@ -28,6 +28,11 @@
"bundle": {
"active": true,
"targets": "all",
"windows": {
"webviewInstallMode": {
"type": "embedBootstrapper"
}
},
"icon": [
"icons/32x32.png",
"icons/128x128.png",
Expand Down
3 changes: 2 additions & 1 deletion src/lib/assets/icons/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ export { default as Cog } from 'lucide-svelte/icons/cog';
export { default as ChevronsUpDown } from 'lucide-svelte/icons/chevrons-up-down';
export { default as Check } from 'lucide-svelte/icons/check';
export { default as Trash2 } from 'lucide-svelte/icons/trash-2';
export { default as Pencil } from 'lucide-svelte/icons/pencil';
export { default as Pencil } from 'lucide-svelte/icons/pencil';
export { default as CircleAlert } from 'lucide-svelte/icons/circle-alert';
2 changes: 1 addition & 1 deletion src/lib/components/custom/highest-unit-form.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
buttonVariants({
variant: 'outline',
className:
'w-full font-normal hover:bg-primary/20 [&:has([data-state=checked])]:bg-primary/20'
'w-full font-normal hover:bg-primary/20 hover:text-white [&:has([data-state=checked])]:bg-primary/20'
}),
{
'cursor-not-allowed': phase_option !== '1P'
Expand Down
40 changes: 28 additions & 12 deletions src/lib/components/custom/load/generic-phase-main-load-form.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script lang="ts" generics="T extends SuperValidated<PhaseMainLoadSchema>">
<script lang="ts" generics="T extends SuperValidated<GenericPhaseMainLoadSchema>">
import { scale } from 'svelte/transition';
import { cubicInOut } from 'svelte/easing';
import { Separator } from '@/components/ui/separator/index.js';
Expand All @@ -11,20 +11,20 @@
import { Checkbox } from '@/components/ui/checkbox/index.js';
import * as Popover from '@/components/ui/popover/index.js';
import * as Command from '@/components/ui/command/index.js';
import * as Alert from '@/components/ui/alert/index.js';
import * as Form from '@/components/ui/form/index.js';
import { useId } from 'bits-ui';
import { tick } from 'svelte';
import { cn } from '@/utils';
import { ChevronsUpDown, Check } from '@/assets/icons';
import { ChevronsUpDown, CircleAlert, Check } from '@/assets/icons';
import {
DEFAULT_TERMINAL_TEMPERATURE_OPTIONS,
DEFAULT_LOADS,
DEFAULT_LOAD_TYPES_OPTIONS,
DEFAULT_LOAD_TYPE_TO_VARIES_LABEL_ENUMS,
load_type_to_varies_label,
DEFAULT_HP_CURRENT_RELATIONSHIP_OPTIONS
} from '@/constants';
import { phase_main_load_schema, type PhaseMainLoadSchema } from '@/schema/load';
import { generic_phase_main_load_schema, type GenericPhaseMainLoadSchema } from '@/schema/load';
import { page } from '$app/stores';
import { addNode, updateNode } from '@/db/mutations';
import { checkNodeExists } from '@/db/queries';
Expand All @@ -47,8 +47,12 @@
const form = superForm(phase_main_load_form, {
SPA: true,
validators: zodClient(phase_main_load_schema),
validators: zodClient(generic_phase_main_load_schema),
onChange(event) {
is_circuit_number_taken_state = {
is_circuit_number_taken: false,
circuit_number: 0
};
if (load_type === 'DEFAULT') {
const { get, paths } = event;
if (paths.includes('load_description') && paths.length === 1) {
Expand Down Expand Up @@ -76,15 +80,15 @@
}
if (panel_id) {
if (
await checkNodeExists({
circuit_number: form.data.circuit_number,
parent_id: panel_id,
node_id: load_to_edit?.id
})
) {
is_circuit_number_taken_state.is_circuit_number_taken = await checkNodeExists({
circuit_number: form.data.circuit_number,
parent_id: panel_id,
node_id: load_to_edit?.id
});
if (is_circuit_number_taken_state.is_circuit_number_taken) {
cancel();
toast.warning('Circuit number already exists');
is_circuit_number_taken_state.circuit_number = form.data.circuit_number;
return;
}
Expand Down Expand Up @@ -132,6 +136,10 @@
let open_terminal_temp = $state(false);
let open_load_type = $state(false);
let open_load_description = $state(false);
let is_circuit_number_taken_state = $state({
is_circuit_number_taken: false,
circuit_number: 0
});
const terminal_temp_trigger_id = useId();
const load_type_trigger_id = useId();
const load_description_trigger_id = useId();
Expand Down Expand Up @@ -180,6 +188,14 @@
</script>

<form method="POST" use:enhance>
{#if is_circuit_number_taken_state.is_circuit_number_taken}
<Alert.Root variant="warning">
<CircleAlert class="size-4" />
<Alert.Description
>Circuit number: {is_circuit_number_taken_state.circuit_number} is already present.</Alert.Description
>
</Alert.Root>
{/if}
<div class="grid grid-cols-2 place-items-start justify-between gap-2">
<Form.Field {form} name="circuit_number">
<Form.Control>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,25 @@
import { buttonVariants } from '@/components/ui/button/index.js';
import * as Popover from '@/components/ui/popover/index.js';
import * as Command from '@/components/ui/command/index.js';
import * as Alert from '@/components/ui/alert/index.js';
import * as Form from '@/components/ui/form/index.js';
import { useId } from 'bits-ui';
import { tick } from 'svelte';
import { cn } from '@/utils';
import { ChevronsUpDown, Check } from '@/assets/icons';
import { ChevronsUpDown, Check, CircleAlert } from '@/assets/icons';
import {
DEFAULT_TERMINAL_TEMPERATURE_OPTIONS,
DEFAULT_PHASES_OPTIONS,
DEFAULT_THREE_PHASE_TYPES_OPTIONS
} from '@/constants';
import { generic_phase_panel_schema, type GenericPhasePanelSchema } from '@/schema/panel';
import type { Phase, PhaseType } from '@/types/phase';
import type { Phase } from '@/types/phase';
import { convertToNormalText } from '@/utils/text';
import { addNode, updateNode } from '@/db/mutations';
import { checkNodeExists } from '@/db/queries';
import { invalidateAll } from '$app/navigation';
import type { Node } from '@/types/project';
import type { TerminalTemperature } from '@/types/load';
interface Props {
generic_phase_panel_form: T;
Expand Down Expand Up @@ -53,15 +55,15 @@
}
if (parent_id) {
if (
await checkNodeExists({
circuit_number: form.data.circuit_number,
parent_id,
node_id: panel_to_edit?.id
})
) {
is_circuit_number_taken_state.is_circuit_number_taken = await checkNodeExists({
circuit_number: form.data.circuit_number,
parent_id,
node_id: panel_to_edit?.id
});
if (is_circuit_number_taken_state.is_circuit_number_taken) {
cancel();
toast.warning('Circuit number already exists');
is_circuit_number_taken_state.circuit_number = form.data.circuit_number;
return;
}
Expand Down Expand Up @@ -90,16 +92,20 @@
$formData.circuit_number = circuit_number as number;
$formData.name = name;
$formData.terminal_temperature = terminal_temperature;
$formData.terminal_temperature = terminal_temperature as TerminalTemperature;
$formData.phase = phase as Phase;
}
});
let open_panel_phase_popover = $state(false);
let open_terminal_temp = $state(false);
let open_phase_type = $state(false);
const phase_trigger_id = useId();
let is_circuit_number_taken_state = $state({
is_circuit_number_taken: false,
circuit_number: 0
});
const phase_trigger_id = useId();
const panel_phase_type_trigger_id = useId();
const terminal_temp_trigger_id = useId();
Expand All @@ -117,6 +123,14 @@
</script>

<form method="POST" use:enhance>
{#if is_circuit_number_taken_state.is_circuit_number_taken}
<Alert.Root variant="warning">
<CircleAlert class="size-4" />
<Alert.Description
>Circuit number: {is_circuit_number_taken_state.circuit_number} is already present.</Alert.Description
>
</Alert.Root>
{/if}
<div class="grid grid-cols-2 gap-2">
<div>
<Form.Field {form} name="name">
Expand Down
4 changes: 4 additions & 0 deletions src/lib/components/custom/sidebar/app-sidebar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,18 @@
import type { SuperValidated } from 'sveltekit-superforms';
import type { Project } from '@/types/project';
import type { Node } from '@/types/project';
import type { GenericPhaseMainLoadSchema } from '@/schema/load';
let {
ref = $bindable(null),
generic_phase_panel_form,
phase_main_load_form,
project,
root_node,
...restProps
}: ComponentProps<typeof Sidebar.Root> & {
generic_phase_panel_form: SuperValidated<GenericPhasePanelSchema>;
phase_main_load_form: SuperValidated<GenericPhaseMainLoadSchema>;
project?: Project;
root_node: Node;
} = $props();
Expand All @@ -44,6 +47,7 @@
node={root_node}
highest_unit={root_node.highest_unit_form}
{generic_phase_panel_form}
{phase_main_load_form}
{project}
/>
{:else}
Expand Down
4 changes: 3 additions & 1 deletion src/lib/components/custom/sidebar/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ export { default as AppSidebar } from './app-sidebar.svelte';
export { default as SidebarHeader } from './sidebar-header.svelte';
export { default as SidebarFooter } from './sidebar-footer.svelte';
export { default as SidebarTree } from './sidebar-tree.svelte';
export { default as AddPanelAndViewTrigger } from './add-panel-and-view-trigger.svelte';
export { default as AddPanelAndViewTrigger } from './add-panel-and-view-trigger.svelte';
export { default as UpdatePanelDialog } from './update-panel-dialog.svelte';
export { default as UpdateLoadDialog } from './update-load-dialog.svelte';
Loading

0 comments on commit 3f7d191

Please sign in to comment.