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

💄 UI responsiveness fixes #1032

Merged
merged 10 commits into from
Jul 5, 2023
125 changes: 92 additions & 33 deletions assets/style.css
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
/*
Note: Bulma styles are a mess. We need to get rid of it eventually.
In the meantime, we use !important occasionally to override Bulma.
Note: Bulma styles are outdated and are not up to industry standards.
We need to get rid of it eventually.
In the meantime, we use '!important' occasionally to override Bulma.
*/

@import url("https://unpkg.com/[email protected]/build/diva.css");


/* Section: General styles */
/* ----------------------- */
/* General styles
/* ----------------------- */

html {
overflow: hidden;
Expand All @@ -21,6 +23,7 @@ body {
margin: 0px;
display: flex;
flex-direction: column;
overflow: scroll;
}

a {
Expand All @@ -36,8 +39,10 @@ a:hover {
justify-content: flex-end;
}

/* ----------------------- */
/* Section: Top Navbar
/* ----------------------- */

/* Section: Top Navbar */
/* CSS in here could use a little clean-up */

.navbar.is-light {
Expand Down Expand Up @@ -209,45 +214,80 @@ a:hover {
display: block;
}

/* Tablet and mobile styles for navbar */
@media screen and (max-width: 1023px) {
/* Tov navbar styles styles for smaller devices */
@media screen and (max-width: 1023px) {
.navbar-menu.is-active {
display: flex;
flex-direction: column;
background-color: #e2e2e2;
min-height: 91vh;
justify-content: space-between;
overflow: scroll;
gap: 30px;
padding: 0;
}
.navbar-start {
gap: 20px;
}
.navbar-main-content-container {
display: flex;
flex-direction: column;
height: 50%;
flex-direction: row;
height: fit-content;
flex-wrap: wrap;
justify-content: space-evenly;
align-content: space-between;
gap: 40px 0px;
}
#unsaved-changes-container {
transform: scale(0.5);
}
.navbar-item.has-dropdown.is-hoverable {
color: #68A7AD;
margin-top: 3vh;
flex-grow: 1;
width: 100%;
display: flex;
flex-direction: column;
gap: 5px;
align-items: flex-start;
}
.navbar-item.has-dropdown.is-hoverable:hover {
background-color: #e2e2e2 !important;
color: #68A7AD !important;
border-radius: 0px;
}
.navbar-element.navbar-btn {
cursor: pointer;
overflow: hidden;
border-bottom: 1px solid #7cb1b7;
font-size: 1.2rem;
width: 100%;
}
.navbar-btn-text {
font-weight: bold;
}
.navbar-dropdown {
border-top: 1px solid #7cb1b7;
border-top: none;
box-shadow: none;
min-width: 13vw;
gap: 5px;
display: flex;
flex-direction: column;
width: 100%;
padding: 0;
}
.navbar-element.navbar-btn:hover {
background-color: #e2e2e2;
color: #7cb1b7 !important;
cursor: auto;
.navbar-dropdown-item {
font-size: 1rem;
}
}
@media only screen and (max-width: 900px) {
#navMenu {
height: 100%;
#feedback-form-btn-container {
margin: 0;
border: none;
border-radius: 0;
}
}

/* Section: Editor Main Body */
/* ----------------------- */
/* Editor Main Body
/* ----------------------- */

#editor-body-container {
overflow: hidden;
Expand Down Expand Up @@ -294,8 +334,10 @@ a:hover {
height: 100%;
}

/* ----------------------- */
/* Section: Editor Panel
/* ----------------------- */

/* Section: Editor Panel */
/* Could use a little clean-up */

#right-column {
Expand Down Expand Up @@ -325,7 +367,6 @@ a:hover {
.panel-heading.focused {
text-decoration: underline;
text-decoration-thickness: 2px;
/* background-color: #b6d8f2; */
}
.panel-heading-title {
max-width: 0px;
Expand Down Expand Up @@ -455,6 +496,7 @@ a:hover {
flex-direction: row;
align-items: center;
justify-content: flex-start;
flex-wrap: wrap;
}
#display-options-separator {
border-right: 2px solid rgb(232 232 232);
Expand Down Expand Up @@ -527,6 +569,7 @@ a:hover {
font-size: 0.875em;
justify-content: center;
width: 100%;
flex-wrap: wrap;
}
#displayContents .button {
width: 10.5em;
Expand Down Expand Up @@ -646,30 +689,44 @@ a:hover {
flex-direction: row;
align-items: center;
justify-content: space-between;
width: 95%;
width: 98%;
flex-wrap: wrap;
margin: 5px 0px;
gap: 10px;
}
.notification-wrapper {
/* padding-left: 10px; */
/* padding-right: 10px; */
padding: 10px;
/* border: 1px solid lightgray; */
background-color: #efefef;
border-radius: 4px;
display: flex;
justify-content: space-between;
align-items: center;
width: 85%;
flex-grow: 1;
}
.remove-notif-icon-wrapper {
height: 100%;
width: 7%;
/* height: 100%; */
width: 30px;
}
.remove-notif-icon {
cursor: pointer;
}

/* Section: Neon Notifications */
/* Navigation panel styles for smaller devices */
@media screen and (max-width: 1023px) {
.notification-container {
justify-content: center;
gap: 7px;
}
.remove-notif-icon-wrapper {
min-width: 30px;
}
}


/* ----------------------- */
/* Neon Notifications
/* ----------------------- */

/* notification keyframes */
@keyframes slideInFromLeft {
Expand Down Expand Up @@ -708,16 +765,16 @@ a:hover {
}

.neon-notification-warning {
/* background: #fae095; */
background: #f5c144;
}

.neon-notification-success {
background: #6dc492;
}


/* Section: Loading Animation */
/* ---------------------------- */
/* Section: Loading Animation
/* ---------------------------- */

/* loading animation keyframes */
@keyframes spin {
Expand Down Expand Up @@ -750,7 +807,9 @@ a:hover {
animation: spin 2s linear infinite;
}

/* Section: Modal Windows */
/* ----------------------- */
/* Section: Modal Windows
/* ----------------------- */

/* neon modal veil */
#neon-modal-window-container {
Expand Down
4 changes: 2 additions & 2 deletions assets/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<div class="navbar-main-content-container" id="navbar-main-content-container-top">
<div class="navbar-element" id="filename"></div>
<div id="unsaved-changes-container">
<img class="navbar-element" id="file-saved" src="/Neon/assets/img/saved-icon.svg">
<img class="navbar-element" id="file-saved" src="/Neon/assets/img/saved-icon.svg" alt="Your work is saved">
</div>
<div class="navbar-element" id="file-status"></div>
</div>
Expand Down Expand Up @@ -151,7 +151,7 @@
<div id="left-column">
<div id="container"></div>
</div>
<div class="is-hidden-mobile" id="right-column">
<div id="right-column">
<div id="display_controls"></div>
<div id="insert_controls"></div>
<div id="edit_controls"></div>
Expand Down
1 change: 1 addition & 0 deletions cypress/e2e/drag/custos.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ function drag (selector: string, offsetX = 0, offsetY = 0): void {
}

beforeEach(() => {
cy.viewport('macbook-11');
cy.visit('http://localhost:8080/editor.html?manifest=test', {
onBeforeLoad(win) {
cy.stub(win.console, 'log').as('consoleLog');
Expand Down
1 change: 1 addition & 0 deletions deployment/server/editor.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width">
<head>
<title>Neon</title>
<script
Expand Down
14 changes: 11 additions & 3 deletions src/SquareEdit/Contents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,14 @@ export const hotkeysModal = `
</div>
<div class="hotkey-entry-description">Hide Glyph</div>
</div>
<div class="hotkey-entry-container">
<div class="hotkey-container">
<div class="hotkey-entry">Shift</div>
<div>+</div>
<div class="hotkey-entry">T</div>
</div>
<div class="hotkey-entry-description">Scroll To Syllable Text</div>
</div>
</div>

<!-- "Edit" hotkeys -->
Expand Down Expand Up @@ -501,10 +509,10 @@ export const hotkeysModal = `
</div>
<div class="hotkey-entry-container">
<div class="hotkey-container">
<div class="hotkey-entry">1/2/3/4</div>
<div class="hotkey-entry">1/2/3/4/5/6</div>
</div>
<div class="hotkey-entry-description">
Select by Syllable/Neume/Neume Component/Staff
Select by Syllable/Neume/Neume Component/Staff/Layer Element/BBox
</div>
</div>
<div class="hotkey-entry-container">
Expand Down Expand Up @@ -553,4 +561,4 @@ export const errorLogsPanelContents =
<use id="toggleErrorLog" xlink:href="${__ASSET_PREFIX__}/assets/img/icons.svg#dropdown-down"></use>
</svg>
</div>
<div class="panel-contents" id="errorLogContents" style="overflow: visible; padding: 0.5em 0.75em;"><div>`;
<div class="panel-contents" id="errorLogContents" style="overflow: scroll; padding: 0.5em 0.75em;"><div>`;
4 changes: 2 additions & 2 deletions src/SquareEdit/Controls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ export function initSelectionButtons (): void {
const selByStaff = document.getElementById('selByStaff');
const selByLayerElement = document.getElementById('selByLayerElement');

selBySyllable.addEventListener('click', selectBySylHandler);
selBySyllable.addEventListener('click', selectBySyllableHandler);
selByNeume.addEventListener('click', selectByNeumeHandler);
selByNc.addEventListener('click', selectByNcHandler);
selByStaff.addEventListener('click', selectByStaffHandler);
Expand All @@ -205,7 +205,7 @@ export function initSelectionButtons (): void {
});


function selectBySylHandler () {
function selectBySyllableHandler () {
if (!selBySyllable.classList.contains('is-active')) {
setSettings({ selectionMode: 'selBySyllable' });

Expand Down
3 changes: 3 additions & 0 deletions src/SquareEdit/InsertHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { EditorAction, InsertAction } from '../Types';
import * as d3 from 'd3';
import { getSVGRelCoords, isOutOfSVGBounds, Point } from '../utils/Coordinates';
import { queueNotification } from '../utils/Notification';
import { setSettings } from '../utils/LocalSettings';

/**
* Class that handles insert mode, events, and actions.
Expand Down Expand Up @@ -160,6 +161,8 @@ class InsertHandler {

insertPanel.querySelector('.side-panel-btn.insertel.is-active').classList.add('unfocused');
editPanel.querySelector('.side-panel-btn.sel-by.is-active').classList.remove('unfocused');

setSettings({ userMode: 'edit' });

}).bind(this);

Expand Down
7 changes: 3 additions & 4 deletions src/SquareEdit/SingleEditMode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,13 @@ class SingleEditMode implements NeumeEditInterface {
document.getElementById(insertMode).classList.add('is-active');
document.getElementById(selectionMode).classList.add('is-active');
switch (userMode) {
case 'edit':
document.getElementById(selectionMode).click();
break;
case 'insert':
document.getElementById(insertMode).click();
break;
case 'edit':
default:
return;
document.getElementById(selectionMode).click();
break;
}
}

Expand Down
9 changes: 9 additions & 0 deletions src/TextEditMode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,15 @@ export default class TextEditMode implements TextEditInterface {
span.removeEventListener('click', selectSylText);
span.addEventListener('click', selectSylText);
});

document.addEventListener('keydown', (event) => {
if (event.shiftKey && event.key === 'T') {
const selectedSylText = document.querySelector('.text-select');
if (selectedSylText) {
selectedSylText.scrollIntoView({ behavior: 'smooth' });
}
}
});
}


Expand Down
2 changes: 1 addition & 1 deletion src/TextView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class TextView implements TextViewInterface {
document.querySelectorAll('.syl.selected .sylTextRect-display')
.forEach((rect: HTMLElement) => { rect.style.fill = 'red'; });

if (this.neonView.TextEdit !== undefined) {
if (this.neonView.getUserMode() !== 'viewer' && this.neonView.TextEdit !== undefined) {
this.neonView.TextEdit.initSelectByBBoxButton();
}

Expand Down
Loading