Skip to content

Commit a9320d2

Browse files
authored
Merge pull request #11 from wim07101993/development
merge to master
2 parents 4548b32 + 54f2e5a commit a9320d2

File tree

15 files changed

+158
-49
lines changed

15 files changed

+158
-49
lines changed
Lines changed: 5 additions & 1 deletion
Loading

frontend/src/config.dev.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ import {ApiConfig} from "./data/scores-api.js";
33

44
export const authConfig = new AuthConfig(
55
'340579470668791812',
6-
new URL('http://plop.home:7000/'),
7-
new URL('https://auth.wvl.app/oauth/v2/authorize'),
8-
new URL('https://auth.wvl.app/oauth/v2/token'),
9-
new URL('https://auth.wvl.app/oidc/v1/userinfo'),
6+
new URL('http://localhost:7003/'),
7+
new URL('https://localhost:7003/oauth/v2/authorize'),
8+
new URL('https://localhost:7003/oauth/v2/token'),
9+
new URL('https://localhost:7003/oidc/v1/userinfo'),
1010
'urn:zitadel:iam:org:project:roles'
1111
);
1212

1313
export const apiConfig = new ApiConfig(
14-
new URL('http://plop.home:7001')
14+
new URL('http://localhost:7001')
1515
);

frontend/src/config.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ import {AuthConfig} from "./data/auth.js";
22
import {ApiConfig} from "./data/scores-api.js";
33

44
export const authConfig = new AuthConfig(
5-
'340579470668791812',
5+
'321160767120408579',
66
new URL('http://localhost:3000/'),
7-
new URL('https://auth.wvl.app/oauth/v2/authorize'),
8-
new URL('https://auth.wvl.app/oauth/v2/token'),
9-
new URL('https://auth.wvl.app/oidc/v1/userinfo'),
7+
new URL('http://localhost:7003/oauth/v2/authorize'),
8+
new URL('http://localhost:7003/oauth/v2/token'),
9+
new URL('http://localhost:7003/oidc/v1/userinfo'),
1010
'urn:zitadel:iam:org:project:roles'
1111
);
1212

1313
export const apiConfig = new ApiConfig(
14-
new URL('http://plop.home:7001')
14+
new URL('http://localhost:7001')
1515
);

frontend/src/data/translations.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ export function getInstrumentName(instrument) {
2222
case 'strings.contrabass': return 'contrabass';
2323
case 'strings.violin': return 'flute';
2424
case 'strings.viola': return 'viola';
25-
case 'voice.vocals': return 'voice';
25+
case 'voice.vocals': return 'vocals';
26+
case 'voice.soprano': return 'soprano';
27+
case 'voice.alto': return 'alto';
28+
case 'voice.tenor': return 'tenor';
29+
case 'voice.bass': return 'bass';
2630
case 'wind.flutes.flute': return 'flute';
2731
case 'wind.reed.bassoon': return 'bassoon';
2832
case 'wind.reed.clarinet': return 'clarinet';

frontend/src/index.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ header {
66

77
#upload-button {
88
place-self: center;
9+
margin-right: 8px;
10+
}
11+
#upload-button:hover > svg {
12+
fill: #444444;
913
}
1014

1115
#score-list {

frontend/src/index.html

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,14 @@
1212

1313
<header>
1414
<h1 id="title">Scores</h1>
15-
<a id="upload-button" hidden href="scores/detail.html">Upload</a>
15+
<a id="upload-button" hidden href="scores/detail.html">
16+
<svg xmlns="http://www.w3.org/2000/svg"
17+
width="24px"
18+
height="24px"
19+
viewBox="0 0 20 20">
20+
<path d="M13 10v6H7v-6H2l8-8l8 8h-5zM0 18h20v2H0v-2z"/>
21+
</svg>
22+
</a>
1623
</header>
1724

1825
<div id="score-list">

frontend/src/scores/detail.css

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
body {
2+
margin: 0;
3+
}
4+
5+
header {
6+
position: fixed;
7+
width: 100%;
8+
display: grid;
9+
background-color: var(--second-background);
10+
grid-template-columns: auto auto auto;
11+
grid-template-rows: auto;
12+
grid-template-areas: "home-button upload-form download-button";
13+
grid-column-gap: 4px;
14+
z-index: 100;
15+
}
16+
header > *{
17+
align-content: center;
18+
}
19+
20+
#home-button {
21+
grid-area: home-button;
22+
justify-self: left;
23+
margin-left: 4px;
24+
}
25+
26+
#upload-form {
27+
grid-area: upload-form;
28+
justify-self: center;
29+
}
30+
31+
#download-button {
32+
grid-area: download-button;
33+
justify-self: right;
34+
background: transparent;
35+
border: transparent;
36+
margin-right: 4px;
37+
}
38+
#download-button:hover > svg {
39+
fill: #444444;
40+
}
41+
42+
#score-musicxml * {
43+
font-family: serif;
44+
}

frontend/src/scores/detail.html

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,32 @@
33
<head>
44
<meta charset="UTF-8">
55
<title>Score detail</title>
6+
<link rel="stylesheet" href="../theme.css">
7+
<link rel="stylesheet" href="detail.css">
68
</head>
79

810
<body>
911
<header>
10-
<h1 id="title"></h1>
12+
<a id="home-button" href="/">Back to the list</a>
13+
<form id='upload-form' hidden>
14+
<input type='file' id='file-input' name='file'/>
15+
<button type='submit' id="upload-button" disabled>
16+
Upload
17+
</button>
18+
</form>
19+
<button id="download-button" hidden>
20+
<svg xmlns="http://www.w3.org/2000/svg"
21+
width="20px"
22+
height="20px"
23+
viewBox="0 0 20 20">
24+
<path d="M13 8V2H7v6H2l8 8l8-8h-5zM0 18h20v2H0v-2z"/>
25+
</svg>
26+
</button>
1127
</header>
1228

13-
<div>
14-
<p id="lyricists"></p>
15-
<p id="composers"></p>
16-
<p id="instruments"></p>
17-
<p id="languages"></p>
18-
<p id="tags"></p>
19-
<p id="last-changed-timestamp"></p>
20-
</div>
21-
2229
<script src="../packages/open_sheet_music_display.1.8.9.min.js"></script>
2330
<script src="detail.js" type="module"></script>
2431

25-
<form id='upload-form' hidden>
26-
<input type='file' id='file-input' name='file'/>
27-
<button type='submit' id="upload-button" disabled>Upload</button>
28-
</form>
29-
3032
<div id='score-musicxml' style='width: 100%' hidden></div>
3133

3234
</body>

frontend/src/scores/detail.js

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ const uploadForm = document.getElementById('upload-form');
1010
const uploadButton = document.getElementById('upload-button');
1111

1212
/**
13-
* @type {string}
13+
* @type {string|null}
1414
*/
1515
let musicXml;
1616
let scoreId;
1717
let accessToken;
1818

1919
/**
2020
* @param scoreId {String}
21-
* @returns {Promise<void>}
21+
* @returns {Promise<string>}
2222
*/
2323
async function loadMusicxml(scoreId) {
2424
let musicxml = null;
@@ -37,11 +37,23 @@ async function loadMusicxml(scoreId) {
3737

3838
if (musicxml == null) {
3939
alert('failed to load music xml');
40-
return;
4140
}
41+
return musicxml;
42+
}
4243

43-
await osmd.load(musicxml)
44-
.then(() => osmd.render());
44+
function downloadMusicXmlFile() {
45+
const blob = new Blob([musicXml], {type: 'application/vnd.recordare.musicxml'});
46+
const url = window.URL.createObjectURL(blob);
47+
48+
const link = document.createElement('a');
49+
link.href = url;
50+
link.download = `${scoreId}.musicxml`;
51+
document.body.appendChild(link);
52+
link.click();
53+
54+
// Clean up
55+
document.body.removeChild(link);
56+
window.URL.revokeObjectURL(url);
4557
}
4658

4759
/**
@@ -95,7 +107,7 @@ async function main() {
95107

96108
fileInput.addEventListener('change', onFileSelected);
97109
uploadForm.addEventListener('submit', onSubmitScore);
98-
if (user?.isScoreEditor === true){
110+
if (user?.isScoreEditor === true) {
99111
document.getElementById('upload-form').hidden = false;
100112
} else {
101113
document.getElementById('upload-form').hidden = true;
@@ -119,7 +131,14 @@ async function main() {
119131
await initializeScoreApp();
120132
fetchScoreUpdates().then(() => loadMusicxml(scoreId));
121133

122-
await loadMusicxml(scoreId);
134+
musicXml = await loadMusicxml(scoreId);
135+
136+
const downloadButton = document.getElementById('download-button');
137+
downloadButton.hidden = false;
138+
downloadButton.onclick = downloadMusicXmlFile;
139+
140+
await osmd.load(musicXml)
141+
.then(() => osmd.render());
123142
}
124143

125144
await main();

go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ require (
88
github.com/jackc/pgx/v5 v5.7.6
99
github.com/kelseyhightower/envconfig v1.4.0
1010
github.com/pkg/errors v0.9.1
11-
golang.org/x/crypto/x509roots/fallback v0.0.0-20251009181029-0b7aa0cfb07b
11+
golang.org/x/crypto/x509roots/fallback v0.0.0-20251027163307-0997000b45e3
1212
)
1313

1414
require (
@@ -18,7 +18,7 @@ require (
1818
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
1919
github.com/jackc/puddle/v2 v2.2.2 // indirect
2020
github.com/lib/pq v1.10.9 // indirect
21-
golang.org/x/crypto v0.37.0 // indirect
22-
golang.org/x/sync v0.13.0 // indirect
23-
golang.org/x/text v0.24.0 // indirect
21+
golang.org/x/crypto v0.43.0 // indirect
22+
golang.org/x/sync v0.17.0 // indirect
23+
golang.org/x/text v0.30.0 // indirect
2424
)

0 commit comments

Comments
 (0)