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

Feature/#176 tooltips #180

Merged
merged 8 commits into from
Jan 23, 2023
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
50 changes: 41 additions & 9 deletions Apps/frontend/package-lock.json

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

3 changes: 2 additions & 1 deletion Apps/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@
"prettier": "2.8.0",
"prettier-plugin-svelte": "^2.8.1",
"sass": "^1.56.2",
"svelte": "^3.52.0",
"svelte": "^3.55.1",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a question. Does sveltestrap require/prefer a newer version of svelte or why did you update?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the feedback!
It automaticallly updated when installing sveltestrap

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we currently even have a mechanism like dependabot that regularly checks the version of our dependencies?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None that I know of

"svelte-toggle": "^3.1.0",
"vite": "^3.2.0"
},
"dependencies": {
"axios": "^1.2.1",
"sveltestrap": "^5.10.0",
"webgl-plot": "^0.7.0"
}
}
4 changes: 4 additions & 0 deletions Apps/frontend/src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
href="https://fonts.googleapis.com/icon?family=Material+Icons"
/>
<link rel="stylesheet" href="node_modules/svelte-material-ui/bare.css" />
<link
rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"
/>
</svelte:head>
<main data-cy="oscilloscope">
<Layout />
Expand Down
6 changes: 5 additions & 1 deletion Apps/frontend/src/assets/mui_drop-down.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions Apps/frontend/src/components/DistributeOffsetButton.svelte
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
<script>
import { NUM_CHANNELS } from "../const";
import { channelActivated, offsetAdjustment } from "../stores";
import { Tooltip } from "sveltestrap";
import { TOOLTIP_BUTTON_DISTRIBUTE } from "../labels";

function calculateOffset() {
// offset is calculated based on the number of channels between -1 and 1
return 2 / ($channelActivated.filter(Boolean).length + 1);
}
let button;
</script>

<button
bind:this={button}
class="icon-button mui-icon--distribute"
on:click={() => {
let baseOffset = calculateOffset();
Expand All @@ -22,3 +26,6 @@
}}
data-cy="distribute-button"
/>
<Tooltip target={button} placement="bottom">
{TOOLTIP_BUTTON_DISTRIBUTE}
</Tooltip>
6 changes: 6 additions & 0 deletions Apps/frontend/src/components/GNDButton.svelte
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
<script>
import { Tooltip } from "sveltestrap";
import { TOOLTIP_BUTTON_GND } from "../labels";

import { createEventDispatcher } from "svelte";
const dispatch = createEventDispatcher();
const handleClick = async (/** @type {boolean} */ down) => {
dispatch("set-gnd", { down: down });
};
let button;
</script>

<button
bind:this={button}
class="icon-button mui-icon--drop-down"
on:mousedown={async () => {
handleClick(true);
Expand All @@ -16,3 +21,4 @@
}}
data-cy="gnd-button"
/>
<Tooltip target={button} placement="bottom">{TOOLTIP_BUTTON_GND}</Tooltip>
10 changes: 10 additions & 0 deletions Apps/frontend/src/components/OnOffButton.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
import clsx from "clsx";
import { createEventDispatcher } from "svelte";
import { osciEnabled } from "../stores";
import { Tooltip } from "sveltestrap";
import {
TOOLTIP_BUTTON_OFFOFF_ON,
TOOLTIP_BUTTON_OFFOFF_OFF,
} from "../labels";

const dispatch = createEventDispatcher();

Expand All @@ -13,9 +18,11 @@
export const click = () => {
handleClick();
};
let button;
</script>

<button
bind:this={button}
data-cy="on-off-button"
class={clsx(
{ "icon-button": true },
Expand All @@ -24,3 +31,6 @@
)}
on:click={handleClick}
/>
<Tooltip target={button} placement="bottom">
{$osciEnabled ? TOOLTIP_BUTTON_OFFOFF_OFF : TOOLTIP_BUTTON_OFFOFF_ON}
</Tooltip>
7 changes: 7 additions & 0 deletions Apps/frontend/src/components/ResetButton.svelte
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
<script>
import { createEventDispatcher } from "svelte";
import { Tooltip } from "sveltestrap";
import { TOOLTIP_BUTTON_RESET } from "../labels";

const dispatch = createEventDispatcher();
$: url = "../assets/mui_reset.svg";

const handleClick = async () => {
dispatch("reset", {});
};
let button;
</script>

<button
bind:this={button}
class="icon-button mui-icon--reset"
on:click={handleClick}
data-cy="reset-button"
/>
<Tooltip target={button} placement="bottom">
{TOOLTIP_BUTTON_RESET}
</Tooltip>
6 changes: 6 additions & 0 deletions Apps/frontend/src/labels.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ export const LABEL_BUTTON_LOAD_CHANNEL_CONFIG = "Load";
export const LABEL_BUTTON_UPDATE_CHANNEL_CONFIG = "Save";
export const LABEL_BUTTON_CANCEL_CHANNEL_CONFIG = "Cancel";

export const TOOLTIP_BUTTON_GND = "GND";
PhlppKrmr marked this conversation as resolved.
Show resolved Hide resolved
export const TOOLTIP_BUTTON_DISTRIBUTE = "Distributes enabled channels vertically";
export const TOOLTIP_BUTTON_RESET = "Cleans the canvas and stops plotting";
export const TOOLTIP_BUTTON_OFFOFF_ON = "Turn on";
export const TOOLTIP_BUTTON_OFFOFF_OFF = "Turn off";

/* Log messages */
export const ERR_MSG_COULD_NOT_RETRIEVE_CHANNEL_CONFIG =
"Could not load channel config!";
Expand Down
3 changes: 2 additions & 1 deletion Apps/frontend/src/views/ChannelConfigControlPanel.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
id="managePresets"
on:click={showPopup}
data-cy="preset-config-open-popup"
>{LABEL_BUTTON_MANAGE_CHANNEL_CONFIG}</button
>
{LABEL_BUTTON_MANAGE_CHANNEL_CONFIG}
</button>
</div>
18 changes: 9 additions & 9 deletions Apps/frontend/src/views/ChannelConfigPopup.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@
</option>
{/each}
</select>
<button id="getChannelConfig" on:click={loadChannelConfigById}
>{LABEL_BUTTON_LOAD_CHANNEL_CONFIG}</button
>
<button id="getChannelConfig" on:click={loadChannelConfigById}>
{LABEL_BUTTON_LOAD_CHANNEL_CONFIG}
</button>
</div>
<div style="margin-left: auto;">
<h3>{LABEL_HEADER_CREATE_CHANNEL_CONFIG}</h3>
Expand All @@ -69,12 +69,12 @@
bind:value={presetName}
on:change={handleSaveButton}
/>
<button id="storeChannelConfig" on:click={storeChannelConfig} disabled
>{LABEL_BUTTON_UPDATE_CHANNEL_CONFIG}</button
>
<button id="storeChannelConfig" on:click={storeChannelConfig} disabled>
{LABEL_BUTTON_UPDATE_CHANNEL_CONFIG}
</button>
</div>
<br />
<button id="cancelChannelConfig" on:click={() => ($presetPopupOpen = false)}
>{LABEL_BUTTON_CANCEL_CHANNEL_CONFIG}</button
>
<button id="cancelChannelConfig" on:click={() => ($presetPopupOpen = false)}>
{LABEL_BUTTON_CANCEL_CHANNEL_CONFIG}
</button>
</div>