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

Reorganize folder structure to match Vue idioms #39

Merged
merged 5 commits into from
Jul 8, 2024
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
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 6 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<link rel="apple-touch-icon" sizes="180x180" href="/src/icons/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/src/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/src/icons/favicon-16x16.png">
<link rel="apple-touch-icon" sizes="180x180" href="/assets/icons/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/assets/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/assets/icons/favicon-16x16.png">

<meta charset="UTF-8" />
<!-- Render to a usable size on mobile -->
<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<link rel="stylesheet" href="https://unpkg.com/leaflet/dist/leaflet.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css" />
<link rel="stylesheet" href="/src/css/main.css" />
<link rel="stylesheet" href="/src/main.css" />

<script src="/src/js/vendor/unmute.js" type="module"></script>
<script src="/src/js/main.js" type="module"></script>
<script src="/src/vendor/unmute.js" type="module"></script>
<script src="/src/main.js" type="module"></script>
</head>

<body></body>
Expand Down
14 changes: 7 additions & 7 deletions src/js/components/App.vue → src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@

<script setup>
import { computed, ref, onMounted } from 'vue';
import CalloutList from './CalloutList.vue';
import MapDisplay from './MapDisplay.vue';
import ToolbarGPX from './ToolbarGPX.vue';
import ToolbarMain from './ToolbarMain.vue';
import { currentBeacon } from '../audio/notabeacon.js';
import { myLocation } from '../spatial/location.js';
import { recentCallouts } from '../audio/sound.js';
import CalloutList from './components/CalloutList.vue';
import MapDisplay from './components/MapDisplay.vue';
import ToolbarGPX from './components/ToolbarGPX.vue';
import ToolbarMain from './components/ToolbarMain.vue';
import { currentBeacon } from './store/beacon.js';
import { myLocation } from './store/location.js';
import { recentCallouts } from './utils/sound.js';

const gpxMode = ref(false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</template>

<script setup>
import { currentBeacon } from '../audio/notabeacon.js';
import { currentBeacon } from '../store/beacon.js';

const toggleBeacon = () => {
if (currentBeacon.beacon) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

<script setup>
import BeaconController from './BeaconController.vue'
import { createBeacon, currentBeacon } from '../audio/notabeacon.js';
import { createBeacon, currentBeacon } from '../store/beacon.js';
import { inject } from 'vue';

const audioQueue = inject('audioQueue');
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
</template>

<script setup>
import mode_exit_wav from "/src/sounds/mode_exit.wav";
import mode_enter_wav from "/src/sounds/mode_enter.wav";
import mode_exit_wav from "/assets/sounds/mode_exit.wav";
import mode_enter_wav from "/assets/sounds/mode_enter.wav";

import { inject, ref, watch } from 'vue';
import { playSpatialSpeech } from '../audio/sound.js';
import { inject, ref } from 'vue';
import { playSpatialSpeech } from '../utils/sound.js';

const props = defineProps({
tracker: Object,
Expand All @@ -39,22 +39,12 @@ var wakeLock = null;
// When mode button is clicked:
// If a mode is currently active, end that mode
// If mode button was different from current mode, start new mode
function toggleMode(newMode) {
async function toggleMode(newMode) {
// required for iOS Safari: first speech must be directly triggered by user action
playSpatialSpeech(" ");

if (activeMode.value == newMode) {
// exit current mode
activeMode.value = null;
} else {
// enter new mode
activeMode.value = newMode;
}
}

watch(activeMode, async (newMode, oldMode) => {
// Clear queued audio
if (oldMode) {
if (activeMode.value) {
audioQueue.stopAndClear();
audioQueue.addToQueue({ soundUrl: mode_exit_wav });
}
Expand All @@ -64,7 +54,10 @@ watch(activeMode, async (newMode, oldMode) => {
props.tracker.stop();

// Stop here if the intent was to end the current mode
if (!newMode) {
if (activeMode.value == newMode) {
// exit current mode
activeMode.value = null;

if (wakeLock) {
// Release the Wake Lock
wakeLock.release().then(() => {
Expand All @@ -75,6 +68,9 @@ watch(activeMode, async (newMode, oldMode) => {
return;
}

// enter new mode
activeMode.value = newMode;

// Request a Wake Lock
if ("wakeLock" in navigator && !wakeLock) {
try {
Expand Down Expand Up @@ -109,7 +105,7 @@ watch(activeMode, async (newMode, oldMode) => {
})
break;
}
});
};

// Reacquire Wake Lock when page regains focus
document.addEventListener("visibilitychange", async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,10 @@ const plotMyLocation = () => {
// Register for updates to location
watch(props.location, (newValue, oldValue) => {
// Map should follow current point
map.setView([newValue.latitude, newValue.longitude], 16);
plotMyLocation();
if (newValue.latitude && newValue.longitude) {
map.setView([newValue.latitude, newValue.longitude], 16);
plotMyLocation();
}
});

const plotBeacon = (lat, lon) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@

<script setup>
import InputSpinner from './InputSpinner.vue';
import cache from '../data/cache.js';
import { recentCallouts } from '../audio/sound.js';
import replayGPX from '../spatial/gpx.js';
import { myLocation } from '../spatial/location.js';
import cache from '../store/cache.js';
import { recentCallouts } from '../utils/sound.js';
import replayGPX from '../utils/gpx.js';
import { myLocation } from '../store/location.js';
import { inject, ref } from 'vue';

const audioQueue = inject('audioQueue');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import MainModeSelector from './MainModeSelector.vue';
import InputSpinner from './InputSpinner.vue';
import VoiceSelector from './VoiceSelector.vue';
import { inject, onMounted, ref } from 'vue';
import { fixedTracker, realTracker } from '../spatial/tracker.js';
import { fixedTracker, realTracker } from '../utils/tracker.js';

const audioQueue = inject('audioQueue');

Expand Down
File renamed without changes.
File renamed without changes.
56 changes: 0 additions & 56 deletions src/js/data/tile.js

This file was deleted.

135 changes: 0 additions & 135 deletions src/js/spatial/geo.js

This file was deleted.

Loading