feat(ui): add new tag to changelogs
This commit is contained in:
parent
312d15a296
commit
396c2c4b4d
@ -1,7 +1,10 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
export let commit: Commit;
|
export let commit: Commit;
|
||||||
|
|
||||||
|
export let isNew = false;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
{@html isNew ? "<b>[NEW]</b>" : ""}
|
||||||
{commit.subject}
|
{commit.subject}
|
||||||
</p>
|
</p>
|
||||||
|
@ -23,7 +23,7 @@ import { commitStore, route } from "stores";
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (newCommits.length > 2) {
|
if (newCommits.length > 1) {
|
||||||
if (window.location.hash !== "#changelog") {
|
if (window.location.hash !== "#changelog") {
|
||||||
if ((await Toast.ask(`There are <b>${newCommits.length}</b> updates. Do you want to see them?`, ["yes", "no"])) === "yes") {
|
if ((await Toast.ask(`There are <b>${newCommits.length}</b> updates. Do you want to see them?`, ["yes", "no"])) === "yes") {
|
||||||
route.set("changelog")
|
route.set("changelog")
|
||||||
|
@ -2,12 +2,7 @@
|
|||||||
import Commit from "components/Changelog/Commit.svelte";
|
import Commit from "components/Changelog/Commit.svelte";
|
||||||
import { commitStore, route } from "stores";
|
import { commitStore, route } from "stores";
|
||||||
|
|
||||||
$: if ($commitStore.length) {
|
let currentCommit = localStorage.getItem("currentCommit");
|
||||||
localStorage.setItem(
|
|
||||||
"currentCommit",
|
|
||||||
$commitStore[$commitStore.length - 1].id
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$: commits =
|
$: commits =
|
||||||
$commitStore.length &&
|
$commitStore.length &&
|
||||||
@ -24,11 +19,13 @@
|
|||||||
return commit;
|
return commit;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$: if (commits.length) {
|
||||||
|
localStorage.setItem("currentCommit", commits[0].id);
|
||||||
|
}
|
||||||
|
|
||||||
let day = $commitStore.length && new Date($commitStore[0].date).getDay();
|
let day = $commitStore.length && new Date($commitStore[0].date).getDay();
|
||||||
|
|
||||||
const checkDate = (commit) => {
|
const checkDate = (commit) => {
|
||||||
console.log(commit);
|
|
||||||
|
|
||||||
const d = new Date(commit.date);
|
const d = new Date(commit.date);
|
||||||
if (d.getDay() != day) {
|
if (d.getDay() != day) {
|
||||||
day = d.getDay();
|
day = d.getDay();
|
||||||
@ -37,6 +34,19 @@
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let isFound = false;
|
||||||
|
const checkIfNew = (commitId) => {
|
||||||
|
console.log(commitId, currentCommit);
|
||||||
|
|
||||||
|
if (isFound) return false;
|
||||||
|
|
||||||
|
if (commitId === currentCommit) {
|
||||||
|
isFound = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
const prettyDate = (date) => {
|
const prettyDate = (date) => {
|
||||||
return new Date(date).toLocaleDateString();
|
return new Date(date).toLocaleDateString();
|
||||||
};
|
};
|
||||||
@ -52,8 +62,7 @@
|
|||||||
{prettyDate(commit.date)}
|
{prettyDate(commit.date)}
|
||||||
</h3>
|
</h3>
|
||||||
{/if}
|
{/if}
|
||||||
|
<Commit {commit} isNew={checkIfNew(commit.id)} />
|
||||||
<Commit {commit} />
|
|
||||||
{/each}
|
{/each}
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user