Skip to content
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

Nautilus UI #31

Draft
wants to merge 46 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
e2c93c6
test commit
skurikka Nov 21, 2023
0c4c3ee
initial objective component
skurikka Nov 21, 2023
cd48071
add nautilus to method list
skurikka Nov 21, 2023
d56095f
add nautilus to problem list
skurikka Nov 21, 2023
fe24fa8
initial for nautilus method screen
skurikka Nov 21, 2023
3fa2e43
functional api for nautilus
skurikka Nov 21, 2023
fa2fe3f
initial nautilus api requests
skurikka Nov 21, 2023
49663a3
test commit
skurikka Nov 29, 2023
8ac8037
add ranks and wheights input
skurikka Dec 5, 2023
3a2249c
add nautilus bar
skurikka Jan 4, 2024
28f1daf
go back and some documentation
skurikka Jan 13, 2024
d49ca20
change back baseurl
skurikka Jan 13, 2024
29ab5d6
remove log
skurikka Jan 13, 2024
1182504
remove log
skurikka Jan 13, 2024
6ed7c14
use fetch, cleanup
skurikka Jan 27, 2024
1157199
initial for iu changes to design
skurikka Feb 14, 2024
10020bf
styling and add weight preference
skurikka Feb 14, 2024
a64219f
add stores to handle preference information
skurikka Feb 19, 2024
c7249a4
restructure nautilus
skurikka Mar 13, 2024
83f0989
improved styling
skurikka Mar 20, 2024
b5860cd
styling changes
skurikka Mar 25, 2024
aa63066
Tooltip and reusable button
skurikka Mar 27, 2024
30c60ab
dismiss tooltip by click
skurikka Mar 27, 2024
e7722a3
small style changes and progress bar improvments
skurikka Mar 27, 2024
6505116
new app state and slight styling
skurikka Mar 27, 2024
118b5ec
add unit to grid and method name to header
skurikka Apr 7, 2024
fa94b43
finalize routing NAUTILUS
skurikka Apr 8, 2024
3be0a7b
refactor
skurikka Apr 8, 2024
6d1d405
initial to remove stores
skurikka Apr 8, 2024
65208a7
new stores for new version, deleted types and new lock
skurikka Apr 8, 2024
b3aabea
new stores for new version, deleted types and new lock
skurikka Apr 8, 2024
f05c7db
add new nautilus bar
skurikka Apr 15, 2024
fd0327a
type iterationDetails
skurikka Apr 15, 2024
8171f18
fix objectives type
skurikka Apr 15, 2024
566e9b3
move types
skurikka Apr 15, 2024
7ec99cf
fix ranking types
skurikka Apr 15, 2024
87479c3
fix weight types
skurikka Apr 15, 2024
8ebf187
fix remaining types
skurikka Apr 16, 2024
7968bfa
fix scrolling
skurikka Apr 16, 2024
15de0ae
minor fixes and new route
skurikka Apr 24, 2024
abcce4d
info texts
skurikka Apr 26, 2024
04d6742
initial for solution page and new header
skurikka Apr 26, 2024
24e1269
new header store
skurikka Apr 26, 2024
2f57693
header text and typo fixes
skurikka Apr 28, 2024
e796bc5
temporary unit and small style adjustment
skurikka Apr 28, 2024
61881b2
temp changes
skurikka Jul 29, 2024
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
66 changes: 42 additions & 24 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions src/lib/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const backend: Backend = {
//
// TODO: Move this to a configuration file.
//
const baseURL = "http://localhost:5000";
export const baseURL = "http://127.0.0.1:5000";

/** A missing token is represented by `undefined`. */
type Token = string | undefined;
Expand Down Expand Up @@ -65,7 +65,7 @@ function set_access_token(token: Token) {
state.access_token.set(token);
}

function get_access_token() {
export function get_access_token() {
return get(state.access_token);
}

Expand Down Expand Up @@ -481,3 +481,11 @@ export function is_point_of_length(value: unknown, n: number): value is Point {
export function problem_has_finite_bounds(problem: Problem) {
return is_point(problem.ideal_point) && is_point(problem.nadir_point);
}

export const methodHeaderText = writable({
boldPart: "",
italicPart: "",
moreInfo: "",
moreInfoText: "",
});
export const selectedProblem = writable({} as Problem);
4 changes: 4 additions & 0 deletions src/lib/components/main/SelectMethod.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
// id: "nimbus",
// display: "NIMBUS",
// },
{
id: "nautilus",
display: "NAUTILUS",
},
{
id: "reference_point_method",
display: "Reference Point Method",
Expand Down
81 changes: 55 additions & 26 deletions src/lib/components/main/Solve.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,65 @@
// Context API?
//

import { login_status, LoginStatus } from "$lib/api";
import type { Problem } from "$lib/api";
import {
login_status,
LoginStatus,
methodHeaderText,
selectedProblem,
type Problem,
} from "$lib/api";

export let problems: Problem[];

import { TabGroup, Tab } from "@skeletonlabs/skeleton";
import SelectProblem from "./SelectProblem.svelte";
import SelectMethod from "./SelectMethod.svelte";
import SolveProblem from "./SolveProblem.svelte";
import { goto } from "$app/navigation";
import { Tab, TabGroup } from "@skeletonlabs/skeleton";
import GeneralError from "../util/undecorated/GeneralError.svelte";
import SelectMethod from "./SelectMethod.svelte";
import SelectProblem from "./SelectProblem.svelte";

let tab = 0;
let selected_problem: Problem | undefined = undefined;
let selected_problem: Problem;
let selected_method = "";

function goto_solve() {
console.log("selected_problem", selected_problem);

if (selected_method === "nimbus") {
methodHeaderText.set({
boldPart: "NIMBUS",
italicPart: "",
moreInfo: "",
moreInfoText: "",
});
} else if (selected_method === "nautilus") {
methodHeaderText.set({
boldPart: "NAUTILUS:",
italicPart:
"Trade-off-free method to approach Pareto optimal solutions using ranks or weights",
moreInfo: "https://desdeo.misitano.xyz",
moreInfoText: "More about NAUTILUS",
});

selectedProblem.set(selected_problem);
} else if (selected_method === "nautnavi") {
methodHeaderText.set({
boldPart: "NAUTILUS Navigator",
italicPart: "",
moreInfo: "",
moreInfoText: "",
});
} else {
methodHeaderText.set({
boldPart: "No method selected yet",
italicPart: "",
moreInfo: "",
moreInfoText: "",
});
}
console.log("selected_method", selected_method);

goto("/solve");
}
</script>

<TabGroup>
Expand All @@ -29,22 +74,15 @@
>
{/if}
{#if selected_problem && selected_method}
<Tab bind:group={tab} name="solve_problem" value={2}
<Tab bind:group={tab} name="solve_problem" value={2} on:click={goto_solve}
>3. Solve the problem</Tab
>
{/if}

<svelte:fragment slot="panel">
{#if tab === 0}
<div class="mb-8">
Please select a problem. Then <button
class="anchor"
on:click={() => {
tab = 1;
}}
disabled={!selected_problem}
>continue to selecting a solution method</button
>.
Please select a problem. Then continue to selecting a solution method.
</div>
<SelectProblem
{problems}
Expand All @@ -53,18 +91,9 @@
/>
{:else if tab === 1 && selected_problem}
<div class="mb-8">
Please select a solution method. Then <button
class="anchor"
on:click={() => {
tab = 2;
}}
disabled={!selected_problem || !selected_method}
>continue to solving the problem</button
>.
Please select a solution method. Then continue to solving the problem.
</div>
<SelectMethod problem={selected_problem} bind:selected_method />
{:else if tab === 2 && selected_problem && selected_method}
<SolveProblem problem={selected_problem} method={selected_method} />
{:else}
<GeneralError />
{/if}
Expand Down
27 changes: 0 additions & 27 deletions src/lib/components/main/SolveProblem.svelte

This file was deleted.

3 changes: 3 additions & 0 deletions src/lib/components/main/stores.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { writable } from "svelte/store";

export const methodNameStore = writable("");
30 changes: 30 additions & 0 deletions src/lib/components/methods/nautilus/Button.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<script lang="ts">
export let mode = "neutral"; // Default mode is neutral
export let disabled = false;
export let text: string;

// Function to determine the button color classes based on the mode
function determineColorClasses(mode: string) {
switch (mode) {
case "delete":
case "reset":
return "bg-red-500 hover:bg-red-600 text-sm font-medium";
case "neutral":
default:
return "bg-blue-500 hover:bg-blue-600 text-sm font-medium";
}
}

// Compute the color classes based on the mode
$: colorClasses = determineColorClasses(mode);
</script>

<button
on:click
{disabled}
class={`cursor-pointer rounded-md border-none px-5 py-2.5 text-white ${
disabled ? "cursor-not-allowed opacity-50" : "opacity-100"
} ${colorClasses}`}
>
{text}
</button>
14 changes: 14 additions & 0 deletions src/lib/components/methods/nautilus/InfoBox.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<script lang="ts">
export let text: string;
</script>

<p class="instructions">{text}</p>

<style>
.instructions {
text-align: justify;
box-shadow: none;
margin-bottom: 20px;
font-size: 14px;
}
</style>
Loading