Skip to content

Commit

Permalink
Merge pull request #14 from sdwalker62/light-theme
Browse files Browse the repository at this point in the history
Light theme
  • Loading branch information
sdwalker62 authored May 20, 2024
2 parents e4de7c3 + aa208f8 commit ad33b4f
Show file tree
Hide file tree
Showing 23 changed files with 320 additions and 201 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,6 @@
"__nullptr": "cpp",
"fstream": "cpp",
"source_location": "cpp"
}
},
"cmake.configureOnOpen": false
}
6 changes: 4 additions & 2 deletions frontend/data/machine_learning/YOLOv8.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

## Setup

In this tutorial we will use Mamba to manage our Python version. Other package managers can be used, just insure you are using Python 3.8 or above and PyTorch 1.7 or above.
==In== this tutorial we will use Mamba to manage our Python version.</mark> Other package managers can be used, just insure you are using Python 3.8 or above and PyTorch 1.7 or above.

### Mamba

Assuming you already have Mamba, create a new environment for the install. If you don't have Mamba, follow any of the available guides to install Mamba on your host machine. Personally, I recommend mambaforge which can be installed using this link:
Assuming you already have Mamba[^1], create a new environment for the install. If you don't have Mamba, follow any of the available guides to install Mamba on your host machine. Personally, I recommend mambaforge which can be installed using this link:

https://github.com/conda-forge/miniforge#mambaforge

Expand Down Expand Up @@ -209,3 +209,5 @@ trained_model = YOLO('/home/dwalker/dev/work/yolov8/runs/detect/train3/weights/b
```python
results = trained_model("/home/dwalker/dev/work/yolov8/6998a487-db76-4051-bb16-ce6cc9dac0fa.0919efc649321c2c244a6d84503c77c1.webp", augment=True, imgsz=640, show=True)
```

[^1]: This is the first footnote.
3 changes: 0 additions & 3 deletions frontend/netlify.toml

This file was deleted.

5 changes: 5 additions & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,17 @@
"@types/node-fetch": "^2.6.11",
"@typescript-eslint/eslint-plugin": "^7.0.0",
"@typescript-eslint/parser": "^7.0.0",
"autoprefixer": "^10.4.19",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-svelte": "^2.35.1",
"postcss": "^8.4.38",
"prettier": "^3.1.1",
"prettier-plugin-svelte": "^3.1.2",
"sass": "^1.77.0",
"svelte": "^4.2.7",
"svelte-check": "^3.6.0",
"svelte-radix": "^1.1.0",
"sveltekit-superforms": "^2.13.0",
"tslib": "^2.4.1",
"typescript": "^5.0.0",
Expand All @@ -51,6 +54,8 @@
"@excalidraw/excalidraw": "^0.17.6",
"@hbsnow/rehype-sectionize": "^1.0.7",
"@xyflow/svelte": "^0.0.41",
"bits-ui": "^0.21.7",
"clsx": "^2.1.1",
"directory-tree": "^3.5.1",
"dotenv": "^16.4.5",
"fs-extra": "^11.2.0",
Expand Down
12 changes: 3 additions & 9 deletions frontend/src/app.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<!doctype html>
<html lang="en">
<title>Athena Document Library</title>
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.svg" />
Expand All @@ -9,14 +10,7 @@
%sveltekit.head%
</head>

<body
style="margin: 0; padding: 0; width: 100vw; height: 100vh; position: absolute; top: 0; left: 0"
data-sveltekit-preload-data="hover"
>
<div
style="margin: 0; padding: 0; width: 100%; height: 100%; position: absolute; top: 0; left: 0"
>
%sveltekit.body%
</div>
<body data-sveltekit-preload-data="hover">
<div>%sveltekit.body%</div>
</body>
</html>
14 changes: 14 additions & 0 deletions frontend/src/lib/assets/icons/ColorBlind.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="36.4453" height="19.4238">
<g>
<rect height="19.4238" opacity="0" width="36.4453" x="0" y="0"/>
<path d="M29.4676 6.56555C28.5731 6.59563 27.7183 7.07957 27.2559 7.91016L23.0371 15.4785C22.8027 15.8691 22.6855 16.3379 22.6855 16.7773C22.6855 16.933 22.698 17.0855 22.7247 17.2327C21.3031 17.7243 19.7309 18.0176 18.0469 18.0176C10.3223 18.0176 4.80469 11.6895 4.80469 9.7168C4.80469 7.73438 10.3223 1.41602 18.0469 1.41602C23.1734 1.41602 27.2697 4.13665 29.4676 6.56555ZM12.5781 9.7168C12.5781 12.6855 15 15.1562 18.0469 15.1562C21.0645 15.1562 23.5059 12.6855 23.5059 9.7168C23.5059 6.66992 21.0645 4.27734 18.0469 4.27734C15 4.27734 12.5781 6.66992 12.5781 9.7168ZM20.0293 9.7168C20.0293 10.791 19.1309 11.6797 18.0469 11.6797C16.9531 11.6797 16.0547 10.791 16.0547 9.7168C16.0547 8.63281 16.9531 7.74414 18.0469 7.74414C19.1309 7.74414 20.0293 8.63281 20.0293 9.7168Z" fill="#ffffff" fill-opacity="0.85"/>
<path d="M30.6934 8.56445L34.9316 16.123C35.0488 16.3379 35.1074 16.5527 35.1074 16.7773C35.1074 17.5098 34.5996 18.0859 33.7891 18.0859L25.332 18.0859C24.5215 18.0859 24.0137 17.5098 24.0137 16.7773C24.0137 16.5527 24.0723 16.3379 24.1895 16.1328L28.418 8.56445C28.6621 8.11523 29.1211 7.89062 29.5605 7.89062C30 7.89062 30.4395 8.11523 30.6934 8.56445ZM28.7402 15.7715C28.7402 16.2305 29.1113 16.6016 29.5605 16.6016C30.0195 16.6016 30.3809 16.2305 30.3906 15.7715C30.3906 15.332 30.0195 14.9512 29.5605 14.9512C29.1113 14.9512 28.7402 15.3223 28.7402 15.7715ZM28.8965 10.9082L28.9746 13.7012C28.9844 14.0332 29.2188 14.2676 29.5605 14.2676C29.9023 14.2676 30.1465 14.0332 30.1562 13.7012L30.2344 10.9082C30.2441 10.5176 29.9707 10.2441 29.5605 10.2441C29.1602 10.2441 28.8867 10.5176 28.8965 10.9082Z" fill="#ffffff" fill-opacity="0.85"/>
</g>
</svg>

<style lang="scss">
svg {
margin-top: 0.25rem;
scale: 0.8;
}
</style>
11 changes: 11 additions & 0 deletions frontend/src/lib/assets/icons/PDFIcon.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
<path fill="currentColor" d="M30 18v-2h-6v10h2v-4h3v-2h-3v-2zm-11 8h-4V16h4a3.003 3.003 0 0 1 3 3v4a3.003 3.003 0 0 1-3 3m-2-2h2a1 1 0 0 0 1-1v-4a1 1 0 0 0-1-1h-2zm-6-8H6v10h2v-3h3a2.003 2.003 0 0 0 2-2v-3a2 2 0 0 0-2-2m-3 5v-3h3l.001 3z"/>
<path fill="currentColor" d="M22 14v-4a.91.91 0 0 0-.3-.7l-7-7A.9.9 0 0 0 14 2H4a2.006 2.006 0 0 0-2 2v24a2 2 0 0 0 2 2h16v-2H4V4h8v6a2.006 2.006 0 0 0 2 2h6v2Zm-8-4V4.4l5.6 5.6Z"/>
</svg>

<style lang="scss">
svg {
scale: 0.8;
}
</style>
8 changes: 4 additions & 4 deletions frontend/src/lib/assets/icons/SearchIcon.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@
<style>
svg {
width: 2rem;
height: 2rem;
margin-top: 0.25rem;
scale: 1.0;
}
.background {
fill: var(--background-7);
fill: var(--background-6);
}
.icon {
fill: var(--font-2);
fill: var(--background-3);
}
</style>
32 changes: 10 additions & 22 deletions frontend/src/lib/assets/icons/ThemeSwitcherIcon.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,19 @@
</g>
</svg>
{:else}
<svg
version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
width="4rem"
height="4rem"
>
<g transform="translate(9, 9)">
<rect height="4rem" opacity="0" width="4rem" x="0" y="0" />
<path
d="M10.8617 3.98515C11.391 3.98515 11.8316 3.54453 11.8316 3.00722L11.8316 0.977924C11.8316 0.44238 11.391 0 10.8617 0C10.3262 0 9.88554 0.44238 9.88554 0.977924L9.88554 3.00722C9.88554 3.54453 10.3262 3.98515 10.8617 3.98515ZM15.726 6.02401C16.1019 6.39374 16.7269 6.39823 17.1064 6.01874L18.5478 4.57382C18.9176 4.20585 18.9158 3.57285 18.5426 3.1916C18.1728 2.82363 17.5478 2.82715 17.1701 3.19687L15.7207 4.6498C15.351 5.02578 15.3527 5.65077 15.726 6.02401ZM17.74 10.8822C17.74 11.4098 18.1887 11.8504 18.7179 11.8504L20.7472 11.8504C21.2748 11.8504 21.7172 11.4098 21.7172 10.8822C21.7172 10.3529 21.2748 9.90429 20.7472 9.90429L18.7179 9.90429C18.1887 9.90429 17.74 10.3529 17.74 10.8822ZM15.7207 15.7474C15.351 16.1252 15.3527 16.7484 15.726 17.1199L17.1771 18.5791C17.5549 18.939 18.1799 18.9293 18.5531 18.564C18.9211 18.1881 18.9193 17.5631 18.5461 17.1916L17.0949 15.7422C16.7252 15.3805 16.1002 15.384 15.7207 15.7474ZM10.8617 17.7793C10.3262 17.7793 9.88554 18.2199 9.88554 18.7474L9.88554 20.7847C9.88554 21.314 10.3262 21.7564 10.8617 21.7564C11.391 21.7564 11.8316 21.314 11.8316 20.7847L11.8316 18.7474C11.8316 18.2199 11.391 17.7793 10.8617 17.7793ZM5.99648 15.7474C5.61523 15.384 4.98222 15.3805 4.6125 15.7422L3.16933 17.1836C2.79609 17.5551 2.79433 18.1801 3.15429 18.556C3.52753 18.9213 4.16054 18.931 4.53827 18.5711L5.98144 17.1199C6.35468 16.7484 6.35643 16.1252 5.99648 15.7474ZM3.97714 10.8822C3.97714 10.3529 3.52675 9.90429 2.99746 9.90429L0.968159 9.90429C0.440623 9.90429 0 10.3529 0 10.8822C0 11.4098 0.440623 11.8504 0.968159 11.8504L2.99746 11.8504C3.52675 11.8504 3.97714 11.4098 3.97714 10.8822ZM5.98144 6.02401C6.35468 5.65878 6.35643 5.01777 5.99648 4.6498L4.55331 3.19687C4.18358 2.83515 3.55058 2.82363 3.18086 3.1916C2.80937 3.57285 2.80586 4.20585 3.16757 4.56581L4.60898 6.01874C4.98047 6.39022 5.60546 6.39374 5.98144 6.02401Z"
fill="#ffffff"
fill-opacity="1"
/>
<path
d="M10.8537 16.0138C13.6547 16.0138 15.9773 13.6912 15.9773 10.8822C15.9773 8.06523 13.6547 5.74257 10.8537 5.74257C8.05273 5.74257 5.73007 8.06523 5.73007 10.8822C5.73007 13.6912 8.05273 16.0138 10.8537 16.0138Z"
fill="#ffffff"
fill-opacity="1"
/>
</g>
</svg>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="4rem" height="4rem">
<g transform="translate(11, 8)">
<rect height="4rem" opacity="0" width="4rem" x="0" y="0"/>
<path d="M10.5664 3.79883C11.0254 3.79883 11.4062 3.41797 11.4062 2.94922L11.4062 0.849609C11.4062 0.380859 11.0254 0 10.5664 0C10.0977 0 9.7168 0.380859 9.7168 0.849609L9.7168 2.94922C9.7168 3.41797 10.0977 3.79883 10.5664 3.79883ZM15.3516 5.80078C15.6836 6.12305 16.2207 6.13281 16.5527 5.80078L18.0469 4.30664C18.3691 3.98438 18.3691 3.4375 18.0469 3.10547C17.7246 2.7832 17.1875 2.7832 16.8555 3.10547L15.3516 4.60938C15.0293 4.94141 15.0293 5.47852 15.3516 5.80078ZM17.334 10.5957C17.334 11.0547 17.7246 11.4355 18.1836 11.4355L20.2832 11.4355C20.7422 11.4355 21.123 11.0547 21.123 10.5957C21.123 10.1367 20.7422 9.74609 20.2832 9.74609L18.1836 9.74609C17.7246 9.74609 17.334 10.1367 17.334 10.5957ZM15.3516 15.3906C15.0293 15.7227 15.0293 16.2598 15.3516 16.582L16.8555 18.0957C17.1875 18.4082 17.7246 18.3984 18.0469 18.0859C18.3691 17.7539 18.3691 17.2168 18.0469 16.8945L16.543 15.3906C16.2207 15.0781 15.6836 15.0781 15.3516 15.3906ZM10.5664 17.3926C10.0977 17.3926 9.7168 17.7734 9.7168 18.2324L9.7168 20.3418C9.7168 20.8008 10.0977 21.1816 10.5664 21.1816C11.0254 21.1816 11.4062 20.8008 11.4062 20.3418L11.4062 18.2324C11.4062 17.7734 11.0254 17.3926 10.5664 17.3926ZM5.77148 15.3906C5.43945 15.0781 4.89258 15.0781 4.57031 15.3906L3.07617 16.8848C2.75391 17.207 2.75391 17.7441 3.06641 18.0762C3.38867 18.3887 3.93555 18.3984 4.26758 18.0859L5.76172 16.582C6.08398 16.2598 6.08398 15.7227 5.77148 15.3906ZM3.78906 10.5957C3.78906 10.1367 3.39844 9.74609 2.93945 9.74609L0.839844 9.74609C0.380859 9.74609 0 10.1367 0 10.5957C0 11.0547 0.380859 11.4355 0.839844 11.4355L2.93945 11.4355C3.39844 11.4355 3.78906 11.0547 3.78906 10.5957ZM5.76172 5.80078C6.08398 5.48828 6.08398 4.93164 5.77148 4.60938L4.27734 3.10547C3.95508 2.79297 3.4082 2.7832 3.08594 3.10547C2.76367 3.4375 2.76367 3.98438 3.07617 4.29688L4.57031 5.80078C4.89258 6.12305 5.42969 6.12305 5.76172 5.80078Z" fill="#292929"/>
<path d="M10.5566 15.5762C13.2715 15.5762 15.5273 13.3203 15.5273 10.5957C15.5273 7.86133 13.2715 5.60547 10.5566 5.60547C7.8418 5.60547 5.58594 7.86133 5.58594 10.5957C5.58594 13.3203 7.8418 15.5762 10.5566 15.5762Z" fill="#000000"/>
</g>
</svg>
{/if}

<style>
svg {
scale: 1.3;
margin-top: 0.25rem;
scale: 0.8;
}
</style>

2 changes: 1 addition & 1 deletion frontend/src/lib/assets/icons/doc.richtext.fill.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 11 additions & 2 deletions frontend/src/lib/components/FileTree/File.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import markdownLogo from '$lib/assets/images/markdown.svg';
// import fileLogo from '$lib/assets/icons/doc.richtext.fill.svg';
import fileLogo from '$lib/assets/icons/doc.richtext.fill.svg';
import { page } from '$app/stores';
// https://codepen.io/sosuke/pen/Pjoqqp
Expand Down Expand Up @@ -34,13 +34,22 @@
</script>

<div class={highlight} id="file-selector-canvas">
<img src={markdownLogo} alt="markdown" />
{#if docPath.endsWith(".pdf")}
<img id="pdf-icon" src={fileLogo} alt="pdf" />
{:else}
<img src={markdownLogo} alt="markdown" />
{/if}
<!-- <img src={markdownLogo} alt="markdown" /> -->
<a data-sveltekit-reload data-sveltekit-preload-data href={docPath}
>{formatName(name).slice(0, -3).replace('.', '')}</a
>
</div>

<style lang="scss">
#pdf-icon {
scale: 0.8;
}
#file-selector-canvas {
display: flex;
align-items: center;
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/lib/components/PDFViewer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,9 @@
<DownloadIcon />
</a>
</div>
<div id="pdf-theme-switcher">
<!-- <div id="pdf-theme-switcher">
<ThemeSwitcherIcon />
</div>
</div> -->
<!-- Page Zoom -->
<div class="zoom-row">
<button
Expand Down Expand Up @@ -458,7 +458,7 @@
#pdf-top-bar {
/* Grid */
display: grid;
grid-template-columns: 60px 60px 1fr 180px;
grid-template-columns: 60px 1fr 180px;
/* Layout */
width: 100%;
Expand Down Expand Up @@ -608,7 +608,7 @@
align-items: center;
justify-content: center;
gap: 1rem;
margin-left: -120px;
margin-left: -60px;
/* width: fit-content; */
}
Expand Down
10 changes: 7 additions & 3 deletions frontend/src/lib/components/TopMenuBar/SearchInput.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@
@media (min-width: 640px) {
display: flex;
border-radius: 7px;
width: 70%;
width: 80%;
max-width: 100%;
text-overflow: ellipsis;
height: 3rem;
gap: 5px;
background: var(--background-2);
gap: 1rem;
background: var(--background-9);
justify-content: start;
align-items: center;
padding-left: 0.5rem;
Expand All @@ -47,10 +49,12 @@
border: none;
font-family: var(--f-Medium), sans-serif;
align-self: center;
width: 100%;
&::placeholder {
color: var(--font-5);
font-size: 1.5rem;
}
}
</style>
112 changes: 62 additions & 50 deletions frontend/src/lib/utils.ts
Original file line number Diff line number Diff line change
@@ -1,50 +1,62 @@
// /*
// This file contains random utility functions that are used throughout the frontend. There is no logic for which functions are placed here.
// */
//
// import { GetObjectCommand, S3Client } from '@aws-sdk/client-s3';
// import dotenv from 'dotenv';
// import { PUBLIC_BUCKET_ID, PUBLIC_BUCKET_ACCESS_KEY } from '$env/static/public';
//
// export interface CookieMap {
// [key: string]: string;
// }
//
// export function getAllCookies() {
// const cookies: CookieMap = {};
// const cookieString: string = document.cookie;
//
// if (cookieString) {
// const cookieArray: string[] = cookieString.split('; ');
// cookieArray.forEach((cookie) => {
// const [name, value] = cookie.split('=');
// cookies[name] = decodeURIComponent(value);
// });
// }
//
// return cookies;
// }
//
// export function retrieveDocuments(url: string, password: string) {
// console.log(url);
// console.log(password);
// dotenv.config();
//
// // TODO:
// // 1. Check that the URL begins with https://
// // 2. Password should be AccessKey since that is what will be used for auth
// // 3. Figure out how to deal with region, maybe ask the user?
// // 4. accessKeyId needs to be provided as well, hardcode for now
//
// const s3Client: S3Client = new S3Client({
// endpoint: 'https://adl.nyc3.digitaloceanspaces.com',
// forcePathStyle: false,
// region: 'nyc3',
// credentials: {
// accessKeyId: PUBLIC_BUCKET_ID,
// secretAccessKey: PUBLIC_BUCKET_ACCESS_KEY
// }
// });
//
// console.log(s3Client);
// }
import { type ClassValue, clsx } from "clsx";
import { twMerge } from "tailwind-merge";
import { cubicOut } from "svelte/easing";
import type { TransitionConfig } from "svelte/transition";

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

type FlyAndScaleParams = {
y?: number;
x?: number;
start?: number;
duration?: number;
};

export const flyAndScale = (
node: Element,
params: FlyAndScaleParams = { y: -8, x: 0, start: 0.95, duration: 150 }
): TransitionConfig => {
const style = getComputedStyle(node);
const transform = style.transform === "none" ? "" : style.transform;

const scaleConversion = (
valueA: number,
scaleA: [number, number],
scaleB: [number, number]
) => {
const [minA, maxA] = scaleA;
const [minB, maxB] = scaleB;

const percentage = (valueA - minA) / (maxA - minA);
const valueB = percentage * (maxB - minB) + minB;

return valueB;
};

const styleToString = (
style: Record<string, number | string | undefined>
): string => {
return Object.keys(style).reduce((str, key) => {
if (style[key] === undefined) return str;
return str + `${key}:${style[key]};`;
}, "");
};

return {
duration: params.duration ?? 200,
delay: 0,
css: (t) => {
const y = scaleConversion(t, [0, 1], [params.y ?? 5, 0]);
const x = scaleConversion(t, [0, 1], [params.x ?? 0, 0]);
const scale = scaleConversion(t, [0, 1], [params.start ?? 0.95, 1]);

return styleToString({
transform: `${transform} translate3d(${x}px, ${y}px, 0) scale(${scale})`,
opacity: t
});
},
easing: cubicOut
};
};
Loading

0 comments on commit ad33b4f

Please sign in to comment.