Skip to content

Commit

Permalink
XD
Browse files Browse the repository at this point in the history
  • Loading branch information
Ignatella committed Jun 15, 2024
1 parent a2e6a49 commit 341f307
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish-tauri.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:

- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.ACTIONS_GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tagName: app-v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version.
releaseName: 'App v__VERSION__'
Expand Down
36 changes: 35 additions & 1 deletion tui/src-tauri/build.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,37 @@
fn main() {
tauri_build::build()
if cfg!(debug_assertions) {
println!("DEV BUILD");
tauri_build::build();
} else {
let mut windows = tauri_build::WindowsAttributes::new();

windows = windows.app_manifest(
r#"
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="requireAdministrator" uiAccess="true" />
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
"#,
);

tauri_build::try_build(tauri_build::Attributes::new().windows_attributes(windows))
.expect("failed to run build script");
};
}
32 changes: 30 additions & 2 deletions tui/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,35 @@
{
"build": {
"beforeDevCommand": "yarn dev",
"beforeBuildCommand": "yarn build"
"beforeBuildCommand": "yarn build",
"frontendDist": "../dist",
"devUrl": "http://localhost:5173"
},
"plugins": {}
"bundle": {
"active": true,
"targets": "all",
"icon": [
"icons/32x32.png",
"icons/128x128.png",
"icons/[email protected]",
"icons/icon.icns",
"icons/icon.ico"
]
},
"productName": "tui",
"version": "0.0.0",
"identifier": "lol.wfis.document-recognition",
"plugins": {},
"app": {
"security": {
"csp": null
},
"windows": [
{
"title": "tui",
"width": 800,
"height": 600
}
]
}
}
21 changes: 21 additions & 0 deletions tui/src-tauri/windows-app.manifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
19 changes: 0 additions & 19 deletions tui/src/lib/utils.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,6 @@
import { type ClassValue, clsx } from 'clsx';
import { twMerge } from 'tailwind-merge';
import moment from 'moment';
import { Activity } from '@/models/activity.ts';

export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}

export const formatDuration = (...activities: Activity[]) => {
const duration = activities.reduce((acc, { start, finish }) => {
const s = moment(start);
const f = moment(finish ?? new Date());
const duration = moment.duration(f.diff(s));

return acc + duration.asSeconds();
}, 0);

const d = moment.duration(duration, 'seconds');

const hours = Math.floor(d.asHours());
const minutes = Math.ceil(d.asMinutes()) % 60;

return `${hours}:${('0' + minutes).slice(-2)}`;
};
1 change: 0 additions & 1 deletion tui/src/pages/AddPerson.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Button } from "@/components/ui/button";
import { Card, CardContent, CardFooter, CardHeader, CardTitle } from "@/components/ui/card";
import { useFileUpload } from "@/hooks/useFileUpload";
import { PersonForm } from "@/shared/PersonForm";

export function AddPerson() {
Expand Down
2 changes: 1 addition & 1 deletion tui/src/pages/PersonInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { useParams } from 'react-router-dom';
const params = useParams();
console.log(params);

const [person, setPerson] = useState<Person>({
const [person, _] = useState<Person>({
first_name: "John",
last_name: "Doe",
pesel: "01240205770",
Expand Down
2 changes: 0 additions & 2 deletions tui/src/routes.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { createBrowserRouter, Navigate } from 'react-router-dom';

import { env } from '$env';
import { Error } from './shared/components/error/Error';
import { Layout } from '@/Layout.tsx';
import { Home, UserRoundPlus } from 'lucide-react';
Expand Down Expand Up @@ -58,5 +57,4 @@ export const router = createBrowserRouter(
]
}
],
{ basename: env.PUBLIC_APP_PREFIX }
);

0 comments on commit 341f307

Please sign in to comment.