Skip to content
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
8 changes: 4 additions & 4 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"format": "prettier --write --experimental-cli src/"
},
"dependencies": {
"@narenratan/scale-library": "1.3.0",
"@narenratan/scale-library": "1.3.1",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The PRs are looking good. My only nitpick is this patch version bump. Adding library functions is at least worth a minor bump. I do appreciate that you're only publishing a small part of a larger system so we can let it slide.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for having a look! Agreed it should really be a minor version bump; I thought I'd try and keep the main scale-library release, the npm package, and the Python package versions consistent (the main scale-library release is at 1.3.0 at the moment).

I've merged the scale-library PR and the new scale-library npm package version is published too.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks, I'll merge tomorrow morning.

"harmonic-entropy": "^0.3.1",
"isomorphic-qwerty": "^0.1.1",
"ji-lattice": "^0.3.2",
Expand Down
139 changes: 0 additions & 139 deletions src/__tests__/similar-scales.spec.ts

This file was deleted.

149 changes: 149 additions & 0 deletions src/components/SimilarScales.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
<script setup lang="ts">
import { onMounted } from 'vue'
import { type Interval } from 'sonic-weave/interval'
import { useSimilarStore } from '@/stores/similar'
import { stemBasename } from '@narenratan/scale-library'

const props = defineProps<{
relativeIntervals: Interval[]
}>()

const similar = useSimilarStore()

onMounted(async () => {
await similar.fetchLibrary()
similar.runComputation(props.relativeIntervals.map((i) => i.totalCents(true)))
})
</script>

<template>
<main class="similar-scales">
<p v-if="similar.isFetching">Fetching scale library data…</p>
<p v-else-if="similar.fetchError" class="error">
Failed to load scale library: {{ similar.fetchError }}
</p>
<template v-else-if="similar.result">
<section>
<h2>Similar scales</h2>
<p v-if="!similar.result.similar.length">No similar scales found.</p>
<table v-else>
<thead>
<tr>
<th>File</th>
<th>Notes</th>
<th>Rotation</th>
<th>Max diff (¢)</th>
</tr>
</thead>
<tbody>
<tr v-for="entry in similar.result.similar" :key="entry.stem">
<td>
<a
:href="`https://scalelibrary.org/scales/${entry.stem}/`"
target="_blank"
rel="noopener"
class="external-link"
>{{ stemBasename(entry.stem) }}</a
>
</td>
<td>{{ entry.notes }}</td>
<td>{{ entry.mode }}</td>
<td>{{ entry.maxDiff.toFixed(1) }}</td>
</tr>
</tbody>
</table>
</section>

<section>
<h2>Child scales</h2>
<p v-if="!similar.result.children.length">No child scales found.</p>
<table v-else>
<thead>
<tr>
<th>File</th>
<th>Notes</th>
<th>Max diff (¢)</th>
</tr>
</thead>
<tbody>
<tr v-for="entry in similar.result.children" :key="entry.stem">
<td>
<a
:href="`https://scalelibrary.org/scales/${entry.stem}/`"
target="_blank"
rel="noopener"
class="external-link"
>{{ stemBasename(entry.stem) }}</a
>
</td>
<td>{{ entry.notes }}</td>
<td>{{ entry.maxDiff.toFixed(1) }}</td>
</tr>
</tbody>
</table>
</section>

<section>
<h2>Parent scales</h2>
<p v-if="!similar.result.parents.length">No parent scales found.</p>
<table v-else>
<thead>
<tr>
<th>File</th>
<th>Notes</th>
<th>Max diff (¢)</th>
</tr>
</thead>
<tbody>
<tr v-for="entry in similar.result.parents" :key="entry.stem">
<td>
<a
:href="`https://scalelibrary.org/scales/${entry.stem}/`"
target="_blank"
rel="noopener"
class="external-link"
>{{ stemBasename(entry.stem) }}</a
>
</td>
<td>{{ entry.notes }}</td>
<td>{{ entry.maxDiff.toFixed(1) }}</td>
</tr>
</tbody>
</table>
</section>
</template>
</main>
</template>

<style scoped>
.similar-scales {
padding: 0.5rem 1rem;
overflow-y: auto;
}
.similar-scales section {
margin-bottom: 1.5rem;
}
.similar-scales table {
border-collapse: collapse;
}
.similar-scales th,
.similar-scales td {
border: 1px solid var(--color-border);
padding: 0.2rem 0.6rem;
}
.similar-scales th {
font-weight: bold;
}
.similar-scales a {
color: var(--color-accent-text-btn);
}
.similar-scales .error {
color: var(--color-error);
}

a.external-link::after {
content: '🔗';
display: inline-block;
margin-left: 0.25rem;
}
</style>
Loading
Loading