Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various Sitewide Fixes & Improvements. #266

Merged
merged 12 commits into from
Jan 22, 2025
Merged

Conversation

IMB11
Copy link
Member

@IMB11 IMB11 commented Jan 16, 2025

Closes #239

  • Fixes rendering update issues with the page version warnings/reminder component.
  • Decreases the wrsv.nl image caching for author avatars from 1 year to 7 days.
  • General documentation of the various parts that make up the whole site.
  • Flag emoji polyfills for locale switcher on browsers which dont render flags. (Chrome on Windows for example)

@IMB11 IMB11 added improvement A new addition to an already existing page framework Related to the website's framework (Vitepress) labels Jan 16, 2025
Copy link

netlify bot commented Jan 16, 2025

Deploy Preview for nimble-elf-d9d491 ready!

Name Link
🔨 Latest commit ae471a2
🔍 Latest deploy log https://app.netlify.com/sites/nimble-elf-d9d491/deploys/6790b518037de50008448bd2
😎 Deploy Preview https://deploy-preview-266--nimble-elf-d9d491.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@IMB11 IMB11 marked this pull request as ready for review January 17, 2025 00:19
@IMB11 IMB11 requested a review from a team as a code owner January 17, 2025 00:19
Comment on lines +59 to +93
// Constructs the appropriate route path for a given version
function buildRoutePath(
currentPath: string,
locale: string | null,
version: string,
isOnLatest: boolean
) {
if (locale) {
// Replace or add version segment while keeping the locale
// e.g. /en/ -> /en/1.2.0/ or /en/1.2.0/ -> /en/1.3.0/
if (!isOnLatest) {
if (version === props.versioningPlugin.latestVersion) {
route = router.route.path.replace(
`/${locale}/${currentVersion.value}/`,
`/${locale}/`
);
return currentPath.replace(`/${locale}/${currentVersion.value}/`, `/${locale}/`);
} else {
route = router.route.path.replace(
`/${locale}/${currentVersion}/`,
`/${locale}/${version}/`
);
// Replace any existing version segment with the new one
return currentPath.replace(`/${locale}/${currentVersion.value}/`, `/${locale}/${version}/`);
}
} else {
route = router.route.path.replace(
`/${locale}/`,
`/${locale}/${version}/`
);
// If currently on latest, just add the new version segment
return currentPath.replace(`/${locale}/`, `/${locale}/${version}/`);
}
} else {
// Non-localized routes
// e.g. / -> /1.2.0/ or /1.2.0/ -> /1.3.0/
if (!isOnLatest) {
if (version === props.versioningPlugin.latestVersion) {
route = router.route.path.replace(`/${currentVersion.value}/`, "/");
return currentPath.replace(`/${currentVersion.value}/`, "/");
} else {
route = router.route.path.replace(
`/${currentVersion.value}/`,
`/${version}/`
);
return currentPath.replace(`/${currentVersion.value}/`, `/${version}/`);
}
} else {
route = router.route.path.replace("/", `/${version}/`);
return currentPath.replace("/", `/${version}/`);
}
}
}
Copy link
Member

@its-miroma its-miroma Jan 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this could simply be something like:

currentPath.replace(
  currentVersion.value === props.versioningPlugin.latestVersion
    ? "/"
    : `/${currentVersion.value}/`,
  newVersion.value === props.versioningPlugin.latestVersion
    ? "/"
    : `/${newVersion.value}/`
);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yours doesn't handle locales

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How so? If you've got /it_it/1.20.4/link/to/page, and you replace /1.20.4/ with /1.21/, you end up with /it_it/1.21/link/to/page, which is correct

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just tried it, it doesn't work when switching between versions whilst a locale is present. What we have works, I dont think it needs to be changed for the sake of changing it.

Copy link
Member

@its-miroma its-miroma Jan 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd forgotten the dollar signs; you may keep it as is if it is not worth changing tho

@IMB11 IMB11 requested a review from a team as a code owner January 17, 2025 17:43
@IMB11 IMB11 requested review from its-miroma and modmuss50 January 17, 2025 17:48
README.md Outdated Show resolved Hide resolved
Co-authored-by: Miroma <136986257+its-miroma@users.noreply.github.com>
@IMB11 IMB11 requested a review from its-miroma January 18, 2025 23:14
its-miroma
its-miroma previously approved these changes Jan 18, 2025
@IMB11 IMB11 added the stage:ready This is ready to be merged label Jan 19, 2025
@its-miroma its-miroma mentioned this pull request Jan 22, 2025
modmuss50
modmuss50 previously approved these changes Jan 22, 2025
@modmuss50 modmuss50 dismissed stale reviews from its-miroma and themself via ae471a2 January 22, 2025 09:06
@its-miroma its-miroma merged commit 8fe84cf into FabricMC:main Jan 22, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
framework Related to the website's framework (Vitepress) improvement A new addition to an already existing page stage:ready This is ready to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Performance issues
3 participants