Skip to content
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
- gui: Show a loading spinner and prevent repeated clicks while a TonieCard background download is in progress
- gui: Fixed TAF track downloads in the TonieInformationModal to use the correct linked/source TAF for Content and Tonies views, including uncached Tonies, and keep track selections across re-renders, screen size changes and audio player updates
- gui: TeddyStudio: Reworked label printing to generate a browser-independent PDF instead of relying on CSS print layouts, including PDF preview and download functionality [https://github.com/toniebox-reverse-engineering/teddycloud_web/issues/286](https://github.com/toniebox-reverse-engineering/teddycloud_web/issues/286)
- gui: adapted outdated hint to new release candidate tags

### Commits

Expand Down
224 changes: 121 additions & 103 deletions package-lock.json

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,24 @@
"@types/node": "^26.6.5",
"@types/react": "^19.3.0",
"@types/react-dom": "^19.3.0",
"@types/w3c-web-serial": "^1.0.8",
"@types/w3c-web-serial": "^1.0.9",
"@vitejs/plugin-react": "^6.1.2",
"antd": "^6.6.6",
"antd": "^6.6.7",
"formik": "^2.4.9",
"i18next": "^26.5.3",
"i18next-browser-languagedetector": "^8.2.1",
"i18next-http-backend": "^4.0.4",
"i18next": "^26.5.10",
"i18next-browser-languagedetector": "^8.2.2",
"i18next-http-backend": "^4.0.5",
"jszip": "^3.10.2",
"react": "^19.3.1",
"react-dom": "^19.3.1",
"react-i18next": "^17.1.0",
"react-i18next": "^17.1.8",
"react-markdown": "^10.1.0",
"react-minimal-pie-chart": "^9.1.2",
"react-router-dom": "^7.18.4",
"react-syntax-highlighter": "^16.1.2",
"styled-components": "^6.6.0",
"typescript": "^7.0.2",
"vite": "^8.3.4",
"vite": "^8.3.5",
"vite-plugin-svgr": "^5.2.0",
"yup": "^1.7.1"
},
Expand Down
1 change: 1 addition & 0 deletions public/translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -1163,6 +1163,7 @@
"newVersionAvailable": "Es ist eine neue Version verfügbar!",
"newVersionDetailsAvailable": "Du verwendest nicht die neueste TeddyCloud-Version. Bitte aktualisiere, um alle Vorteile der neuesten Veröffentlichung zu erhalten!",
"newVersionDetailsAvailableDevelop": "Du verwendest nicht die neueste TeddyCloud-Develop-Version. Bitte aktualisiere, um alle Vorteile der neuesten Develop-Version zu erhalten!",
"newVersionDetailsAvailableReleaseCandidate": "Du verwendest nicht die neueste TeddyCloud-Release-Kandidaten-Version. Bitte aktualisiere, um alle Vorteile der neuesten Release-Kandidaten-Version zu erhalten!",
"newVersionShort": "Update verfügbar",
"openNewVersionInGithub": "Neueste Version auf GitHub öffnen"
},
Expand Down
1 change: 1 addition & 0 deletions public/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1163,6 +1163,7 @@
"newVersionAvailable": "There is a new version available!",
"newVersionDetailsAvailable": "You are not using the latest TeddyCloud version. Please update to get all benefits of the latest release!",
"newVersionDetailsAvailableDevelop": "You are not using the latest TeddyCloud develop version. Please update to get all benefits of the latest develop version!",
"newVersionDetailsAvailableReleaseCandidate": "You are not using the latest TeddyCloud release candidate version. Please update to take full advantage of the latest release candidate!",
"newVersionShort": "Update available",
"openNewVersionInGithub": "Open the latest version on GitHub"
},
Expand Down
1 change: 1 addition & 0 deletions public/translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -1163,6 +1163,7 @@
"newVersionAvailable": "¡Hay una nueva versión disponible!",
"newVersionDetailsAvailable": "No estás usando la versión más reciente de TeddyCloud. Actualiza para obtener todos los beneficios de la última versión.",
"newVersionDetailsAvailableDevelop": "No estás usando la versión más reciente de la versión develop de TeddyCloud. Actualiza para obtener todos los beneficios de la última versión develop.",
"newVersionDetailsAvailableReleaseCandidate": "No estás utilizando la última versión candidata de TeddyCloud. ¡Actualiza para aprovechar todas las ventajas de la última versión candidata!",
"newVersionShort": "Actualización disponible",
"openNewVersionInGithub": "Abrir la última versión en GitHub"
},
Expand Down
1 change: 1 addition & 0 deletions public/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -1163,6 +1163,7 @@
"newVersionAvailable": "Une nouvelle version est disponible !",
"newVersionDetailsAvailable": "Tu n'utilises pas la dernière version de TeddyCloud. Mets à jour pour profiter de tous les avantages de la dernière version !",
"newVersionDetailsAvailableDevelop": "Tu n'utilises pas la dernière version develop de TeddyCloud. Mets à jour pour profiter de tous les avantages de la dernière version develop !",
"newVersionDetailsAvailableReleaseCandidate": "Vous n'utilisez pas la dernière version candidate de TeddyCloud. Veuillez effectuer la mise à jour pour profiter pleinement des avantages de cette dernière version candidate !",
"newVersionShort": "Mise à jour disponible",
"openNewVersionInGithub": "Ouvrir la dernière version sur GitHub"
},
Expand Down
1 change: 1 addition & 0 deletions public/translations/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -1163,6 +1163,7 @@
"newVersionAvailable": "È disponibile una nuova versione!",
"newVersionDetailsAvailable": "Non stai utilizzando l'ultima versione di TeddyCloud. Aggiorna per usufruire di tutti i vantaggi dell'ultima release!",
"newVersionDetailsAvailableDevelop": "Non stai utilizzando l'ultima versione di sviluppo di TeddyCloud. Aggiorna per usufruire di tutti i vantaggi dell'ultima versione di sviluppo!",
"newVersionDetailsAvailableReleaseCandidate": "Non stai utilizzando l'ultima versione candidata al rilascio di TeddyCloud. Aggiorna per sfruttare tutti i vantaggi dell'ultima versione candidata!",
"newVersionShort": "Aggiornamento disponibile",
"openNewVersionInGithub": "Apri l'ultima versione su GitHub"
},
Expand Down
1 change: 1 addition & 0 deletions public/translations/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -1163,6 +1163,7 @@
"newVersionAvailable": "Dostępna jest nowa wersja!",
"newVersionDetailsAvailable": "Nie korzystasz z najnowszej wersji TeddyCloud. Zaktualizuj, aby uzyskać wszystkie korzyści najnowszego wydania!",
"newVersionDetailsAvailableDevelop": "Nie korzystasz z najnowszej wersji rozwojowej TeddyCloud. Zaktualizuj, aby uzyskać wszystkie korzyści najnowszej wersji rozwojowej!",
"newVersionDetailsAvailableReleaseCandidate": "Nie korzystasz z najnowszej wersji kandydującej do wydania TeddyCloud. Zaktualizuj ją, aby móc korzystać ze wszystkich zalet najnowszej wersji kandydującej!",
"newVersionShort": "Dostępna aktualizacja",
"openNewVersionInGithub": "Otwórz najnowszą wersję na GitHubie"
},
Expand Down
18 changes: 12 additions & 6 deletions src/components/common/footer/StyledFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ export const StyledFooter = () => {
latestDevelopSHA,
newVersionAvailable,
isDevelopVersion,
isReleaseCandidateVersion,
latestReleaseCandidateTag,
} = useTeddyCloudVersion();

const [isAudioPlayerVisible, setIsAudioPlayerVisible] = useState(false);
Expand Down Expand Up @@ -85,9 +87,11 @@ export const StyledFooter = () => {
<small style={{ display: "flex", color: colorText, whiteSpace: "nowrap" }}>
<Link
to={
isDevelopVersion
? gitHubTCCommitTreeBaseUrl + commitGitSha
: gitHubTCReleasesUrl + "tag/tc_" + versionShort
isReleaseCandidateVersion
? gitHubTCCommitTreeBaseUrl + latestReleaseCandidateTag
: isDevelopVersion
? gitHubTCCommitTreeBaseUrl + commitGitSha
: gitHubTCReleasesUrl + "tag/tc_" + versionShort
}
target="_blank"
rel="noopener noreferrer"
Expand All @@ -109,9 +113,11 @@ export const StyledFooter = () => {
<span style={{ paddingRight: 8 }}>-</span>
<Link
to={
isDevelopVersion
? gitHubTCCommitTreeBaseUrl + latestDevelopSHA
: gitHubTCReleasesUrl + "tag/" + latestReleaseVersion
isReleaseCandidateVersion
? gitHubTCCommitTreeBaseUrl + latestReleaseCandidateTag
: isDevelopVersion
? gitHubTCCommitTreeBaseUrl + latestDevelopSHA
: gitHubTCReleasesUrl + "tag/" + latestReleaseVersion
}
target="_blank"
rel="noopener noreferrer"
Expand Down
17 changes: 13 additions & 4 deletions src/components/home/features/Features.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@ import { ExportOutlined } from "@ant-design/icons";

export const Features = () => {
const { t } = useTranslation();
const { version, versionShort, isDevelopVersion, commitGitSha } = useTeddyCloudVersion();
const {
version,
versionShort,
isDevelopVersion,
commitGitSha,
isReleaseCandidateVersion,
latestReleaseCandidateTag,
} = useTeddyCloudVersion();

const features = t("home.features.features", {
returnObjects: true,
Expand All @@ -28,9 +35,11 @@ export const Features = () => {
{t("home.build")}:{" "}
<Link
to={
isDevelopVersion
? gitHubTCCommitTreeBaseUrl + commitGitSha
: gitHubTCReleasesUrl + "tag/tc_" + versionShort
isReleaseCandidateVersion
? gitHubTCCommitTreeBaseUrl + latestReleaseCandidateTag
: isDevelopVersion
? gitHubTCCommitTreeBaseUrl + commitGitSha
: gitHubTCReleasesUrl + "tag/tc_" + versionShort
}
target="_blank"
rel="noopener noreferrer"
Expand Down
26 changes: 18 additions & 8 deletions src/components/home/home/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,14 @@ const { Paragraph } = Typography;
export const Home = () => {
const { t } = useTranslation();
const navigate = useNavigate();
const { newVersionAvailable, isDevelopVersion, latestDevelopSHA, latestReleaseVersion } =
useTeddyCloudVersion();
const {
newVersionAvailable,
isDevelopVersion,
isReleaseCandidateVersion,
latestReleaseCandidateTag,
latestDevelopSHA,
latestReleaseVersion,
} = useTeddyCloudVersion();

const {
tonies,
Expand Down Expand Up @@ -76,16 +82,20 @@ export const Home = () => {
description={
<>
<Paragraph>
{isDevelopVersion
? t("teddycloud.newVersionDetailsAvailableDevelop")
: t("teddycloud.newVersionDetailsAvailable")}{" "}
{isReleaseCandidateVersion
? t("teddycloud.newVersionDetailsAvailableReleaseCandidate")
: isDevelopVersion
? t("teddycloud.newVersionDetailsAvailableDevelop")
: t("teddycloud.newVersionDetailsAvailable")}{" "}
</Paragraph>

<Link
to={
isDevelopVersion
? gitHubTCCommitTreeBaseUrl + latestDevelopSHA
: gitHubTCReleasesUrl + "tag/" + latestReleaseVersion
isReleaseCandidateVersion
? gitHubTCCommitTreeBaseUrl + latestReleaseCandidateTag
: isDevelopVersion
? gitHubTCCommitTreeBaseUrl + latestDevelopSHA
: gitHubTCReleasesUrl + "tag/" + latestReleaseVersion
}
target="_blank"
rel="noopener noreferrer"
Expand Down
72 changes: 67 additions & 5 deletions src/hooks/useTeddyCloudVersion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,25 @@ import { defaultAPIConfig } from "../config/defaultApiConfig";

const api = new TeddyCloudApi(defaultAPIConfig());

interface GitHubRef {
ref: string;
node_id: string;
url: string;
object: {
sha: string;
type: string;
url: string;
};
}

const parseRcVersion = (ref: string): number[] | null => {
const match = ref.match(/^refs\/tags\/rc_v(\d+)\.(\d+)\.(\d+)(?:-(?:rc)?(\d+))?$/);

return match
? [Number(match[1]), Number(match[2]), Number(match[3]), Number(match[4] ?? 0)]
: null;
};

export const useTeddyCloudVersion = () => {
const [version, setVersion] = useState("");
const [versionShort, setVersionShort] = useState("");
Expand All @@ -12,7 +31,10 @@ export const useTeddyCloudVersion = () => {

const [newVersionAvailable, setNewVersionAvailable] = useState<boolean>(false);
const [isDevelopVersion, setIsDevelopVersion] = useState<boolean>(false);
const [isReleaseCandidateVersion, setIsReleaseCandidateVersion] = useState<boolean>(false);

const [latestDevelopSHA, setLatestDevelopSHA] = useState("");
const [latestReleaseCandidateTag, setLatestReleaseCandidateTag] = useState("");
const [latestReleaseVersion, setLatestReleaseVersion] = useState("");

useEffect(() => {
Expand Down Expand Up @@ -42,17 +64,55 @@ export const useTeddyCloudVersion = () => {
return;
}

const develop = versionShort.endsWith("X.X.X");
const develop = versionShort.endsWith("X.X.X") && !versionShort.includes("rc");
const releaseCandidate = versionShort.includes("rc");

setIsDevelopVersion(develop);
setIsReleaseCandidateVersion(releaseCandidate);

const endpoint = develop
? "/reverseGeneric/teddycloud_develop"
: "/reverseGeneric/teddycloud_release";
const endpoint = releaseCandidate
? "/reverseGeneric/teddycloud_release_candidate"
: develop
? "/reverseGeneric/teddycloud_develop"
: "/reverseGeneric/teddycloud_release";

api.apiGetTeddyCloudApiRaw(endpoint)
.then((response) => response.json())
.then((versionInfo) => {
if (develop) {
if (releaseCandidate) {
const refs = versionInfo as GitHubRef[];

const candidates = refs
.map((ref) => ({
...ref,
version: parseRcVersion(ref.ref),
}))
.filter((ref) => ref.version !== null && ref.object.type === "commit");

candidates.sort((a, b) => {
const va = a.version!;
const vb = b.version!;

for (let i = 0; i < 4; i++) {
if (va[i] !== vb[i]) {
return vb[i] - va[i];
}
}

return 0;
});

const latestSHA = candidates[0]?.object.sha;

if (!latestSHA) {
return;
}

setLatestReleaseCandidateTag(candidates[0].ref.replace("refs/tags/", ""));
setNewVersionAvailable(
!commitGitSha.includes("unknown") && commitGitSha !== latestSHA,
);
} else if (develop) {
const latestDevelopSHA = versionInfo.sha;
setNewVersionAvailable(
!commitGitSha.includes("unknown") && commitGitSha !== latestDevelopSHA,
Expand All @@ -75,8 +135,10 @@ export const useTeddyCloudVersion = () => {
commitGitShaShort,
commitGitSha,
latestDevelopSHA,
latestReleaseCandidateTag,
latestReleaseVersion,
newVersionAvailable,
isDevelopVersion,
isReleaseCandidateVersion,
};
};
Loading