mirror of
https://github.com/wukko/cobalt.git
synced 2024-11-18 06:09:58 +00:00
changelogManager: refactor
This commit is contained in:
parent
7a7343bf13
commit
2d1c1782de
1 changed files with 19 additions and 17 deletions
|
@ -5,33 +5,35 @@ let changelog = loadJSON('./src/modules/changelog/changelog.json')
|
||||||
|
|
||||||
export default function(string) {
|
export default function(string) {
|
||||||
try {
|
try {
|
||||||
|
const currentChangelog = changelog.current;
|
||||||
|
|
||||||
switch (string) {
|
switch (string) {
|
||||||
case "version":
|
case "version":
|
||||||
return `<span class="text-backdrop changelog-tag-version">v.${changelog["current"]["version"]}</span>${
|
return `<span class="text-backdrop changelog-tag-version">v.${currentChangelog.version}</span>${
|
||||||
changelog["current"]["date"] ? `<span class="changelog-tag-date">· ${changelog["current"]["date"]}</span>` : ''
|
currentChangelog.date ? `<span class="changelog-tag-date">· ${currentChangelog.date}</span>` : ''
|
||||||
}`
|
}`
|
||||||
case "title":
|
case "title":
|
||||||
return replaceBase(changelog["current"]["title"]);
|
return replaceBase(currentChangelog.title);
|
||||||
case "banner":
|
case "banner":
|
||||||
return changelog["current"]["banner"] ? {
|
const currentBanner = changelog.current.banner;
|
||||||
url: `updateBanners/${changelog["current"]["banner"]["file"]}`,
|
return currentBanner ? {
|
||||||
width: changelog["current"]["banner"]["width"],
|
...currentBanner,
|
||||||
height: changelog["current"]["banner"]["height"]
|
url: `updateBanners/${currentBanner.file}`
|
||||||
} : false;
|
} : false;
|
||||||
case "content":
|
case "content":
|
||||||
return replaceBase(changelog["current"]["content"]);
|
return replaceBase(currentChangelog.content);
|
||||||
case "history":
|
case "history":
|
||||||
return changelog["history"].map((i) => {
|
return changelog.history.map((log) => {
|
||||||
|
const banner = log.banner;
|
||||||
return {
|
return {
|
||||||
title: replaceBase(i["title"]),
|
title: replaceBase(log.title),
|
||||||
version: `<span class="text-backdrop changelog-tag-version">v.${i["version"]}</span>${
|
version: `<span class="text-backdrop changelog-tag-version">v.${log.version}</span>${
|
||||||
i["date"] ? `<span class="changelog-tag-date">· ${i["date"]}</span>` : ''
|
log.date ? `<span class="changelog-tag-date">· ${log.date}</span>` : ''
|
||||||
}`,
|
}`,
|
||||||
content: replaceBase(i["content"]),
|
content: replaceBase(log.content),
|
||||||
banner: i["banner"] ? {
|
banner: banner ? {
|
||||||
url: `updateBanners/${i["banner"]["file"]}`,
|
...banner,
|
||||||
width: i["banner"]["width"],
|
url: `updateBanners/${banner.file}`
|
||||||
height: i["banner"]["height"]
|
|
||||||
} : false,
|
} : false,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue