Skip to content

Commit

Permalink
Re-added the version update notifier (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
scmmmh authored Feb 2, 2024
1 parent 56e945b commit 880bc9d
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 deletions.
12 changes: 12 additions & 0 deletions museum_map/server/frontend/src/Root.svelte
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<script lang="ts">
import { derived } from "svelte/store";
import { Route, NotFoundRoute } from "./simple-svelte-router";
import { createQuery } from "@tanstack/svelte-query";
import Lobby from "./routes/Lobby.svelte";
import Room from "./routes/Room.svelte";
import Loading from "./components/Loading.svelte";
import Research from "./components/Research.svelte";
import Reload from "./components/Reload.svelte";
import Demographics from "./routes/Demographics.svelte";
import { apiRequest } from "./util";
Expand All @@ -19,6 +21,13 @@
queryFn: apiRequest<APIStatus>,
refetchInterval: 60000,
});
const reloadRequired = derived(apiStatus, (apiStatus) => {
if (apiStatus.isSuccess && apiStatus.data.version !== "0.9.1") {
return true;
}
return false;
});
</script>

<div class="bg-neutral-600 min-h-screen">
Expand All @@ -35,6 +44,9 @@
<NotFoundRoute><Lobby /></NotFoundRoute>
</main>
<Research />
{#if $reloadRequired}
<Reload />
{/if}
{:else if $apiStatus.isLoading}
<Loading />
{:else if $apiStatus.isError}
Expand Down
18 changes: 18 additions & 0 deletions museum_map/server/frontend/src/components/Reload.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<div class="fixed right-0 bottom-0 mr-2 mb-2">
<a
href="/"
aria-label="Contribute to our research"
class="relative block p-2 text-white bg-blue-800 rounded-lg"
>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
class="w-8 h-8 md:w-12 md:h-12"
fill="currentColor"
aria-hidden="true"
><title>Reload the interface to update to the latest version</title><path
d="M2 12C2 16.97 6.03 21 11 21C13.39 21 15.68 20.06 17.4 18.4L15.9 16.9C14.63 18.25 12.86 19 11 19C4.76 19 1.64 11.46 6.05 7.05C10.46 2.64 18 5.77 18 12H15L19 16H19.1L23 12H20C20 7.03 15.97 3 11 3C6.03 3 2 7.03 2 12Z"
/></svg
>
</a>
</div>
6 changes: 2 additions & 4 deletions prepare_release.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Script to prepare the version information for a release."""

import re
from typing import List

VERSION = "0.9.1"

Expand Down Expand Up @@ -33,7 +33,5 @@ def replace_version(line: str) -> str:
"museum_map/server/frontend/package.json", r'(^ "version": ")[0-9]+\.[0-9]+\.[0-9]+(?:b[0-9]+)?(",$)', VERSION
)
update_version("museum_map/__about__.py", r'(^__version__ = ")[0-9]+\.[0-9]+\.[0-9]+(?:b[0-9]+)?("$)', VERSION)
update_version(
"museum_map/server/frontend/src/store/config.ts", r'^(.*)[0-9]+\.[0-9]+\.[0-9]+(?:b[0-9]+)?(.*$)', VERSION
)
update_version("museum_map/server/frontend/src/Root.svelte", r"^(.*)[0-9]+\.[0-9]+\.[0-9]+(?:b[0-9]+)?(.*$)", VERSION)
update_version("CHANGELOG.md", r"(## )Dev($)", VERSION)

0 comments on commit 880bc9d

Please sign in to comment.