This commit is contained in:
2025-04-18 16:59:50 +02:00
parent 9c2d40ea96
commit b314c257e5
2 changed files with 62 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
---
authors: Kleo
title: Refactoring
description: The current codebase isn't practical, so we are refractoring it
image: https://preview.redd.it/axscigvvfik71.png?auto=webp&s=ddd458f865c6f50d21a66fe76dc12a07c8b1e198
date: 2025-04-18
tags: development, news
---
Due to Minecraft's nature of refactors for the past decade (which is normal for all apps), we have decided to refactor the codebase to make it more maintainable and practical. This will also take us in other versions of Minecraft.
We will be working on this in the next few weeks trying to improve both the codebase and the user experience.
## Goals
- 📖 Document every change done to the code, both in discord and in the github wiki, this is mandatory.
- 🧩 Separate as much code from Minecraft as possible (abstractions), important for adding other versions.
- 🎨 Make the UI as customizable as possible, good for user experience, we should keep this in mind.
For updates, check out our [Discord](https://discord.gg/HFRsNxfCqT) or [GitHub issue](https://github.com/saturnclientmc/saturnclient/issues/1)
---
Credits to [Electronic_Sample_96](https://www.reddit.com/r/Minecraft/comments/pejvos/an_ultrawide_wallpaper_on_minecraft_2560_x_1080/) for the image
+40
View File
@@ -0,0 +1,40 @@
import smartSplit from "./smartSplit";
export interface News {
authors: string[];
title: string;
description: string;
image: string;
date: string;
id: string;
}
export function parseNews(news: string, id: string): News {
const content = news.split("---", 2)[1];
const params: News = {
authors: [],
title: "Undefined title",
description: "",
image: "/background.png",
date: "Undefined date",
id,
};
content.split("\n").forEach((v) => {
const [key, value] = smartSplit(v, ":", 2).map((v) => v.trim());
if (key === "authors") {
params.authors = value.split(",").map((v) => v.trim());
} else if (
key === "title" ||
key === "description" ||
key === "image" ||
key === "date"
) {
params[key] = value;
}
});
return params;
}