Files
api/web/helpers/urls.ts
Eli Bosley 2c62e0ad09 feat: tailwind v4 (#1522)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Streamlined Tailwind CSS integration using Vite plugin, eliminating
the need for separate Tailwind config files.
* Updated theme and color variables for improved consistency and
maintainability.

* **Style**
* Standardized spacing, sizing, and font classes across all components
using Tailwind’s default scale.
* Reduced excessive gaps, padding, and font sizes for a more compact and
cohesive UI.
* Updated gradient, border, and shadow classes to match Tailwind v4
conventions.
* Replaced custom pixel-based classes with Tailwind’s bracketed
arbitrary value syntax where needed.
* Replaced focus outline styles from `outline-none` to `outline-hidden`
for consistent focus handling.
* Updated flex shrink/grow utility classes to use newer shorthand forms.
* Converted several component templates to use self-closing tags for
cleaner markup.
  * Adjusted icon sizes and spacing for improved visual balance.

* **Chores**
* Removed legacy Tailwind/PostCSS configuration files and related
scripts.
* Updated and cleaned up package dependencies for Tailwind v4 and
related plugins.
  * Removed unused or redundant build scripts and configuration exports.
  * Updated documentation to reflect new Tailwind v4 usage.
  * Removed Prettier Tailwind plugin from formatting configurations.
* Removed Nuxt Tailwind module in favor of direct Vite plugin
integration.
  * Cleaned up ESLint config by removing Prettier integration.

* **Bug Fixes**
  * Corrected invalid or outdated Tailwind class names and syntax.
* Fixed issues with max-width and other utility classes for improved
layout consistency.

* **Tests**
* Updated test assertions to match new class names and styling
conventions.

* **Documentation**
* Revised README and internal notes to clarify Tailwind v4 adoption and
configuration changes.
* Added new development notes emphasizing Tailwind v4 usage and
documentation references.

* **UI Components**
* Enhanced BrandButton stories with detailed variant, size, and padding
showcases for better visual testing.
* Improved theme store to apply dark mode class on both `<html>` and
`<body>` elements for compatibility.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-21 09:58:02 -04:00

73 lines
2.8 KiB
TypeScript

const ACCOUNT = new URL(sessionStorage.getItem('unraidAccountUrl') ?? import.meta.env.VITE_ACCOUNT ?? 'https://account.unraid.net');
const DOCS = new URL('https://docs.unraid.net');
const FORUMS = new URL('https://forums.unraid.net');
const UNRAID_NET = new URL(sessionStorage.getItem('unraidPurchaseUrl') ?? import.meta.env.VITE_UNRAID_NET ?? 'https://unraid.net');
const ACCOUNT_CALLBACK = new URL('c', ACCOUNT);
const FORUMS_BUG_REPORT = new URL('/bug-reports', FORUMS);
const CONNECT_DOCS = new URL('/go/connect/', DOCS);
const CONNECT_DASHBOARD = new URL(import.meta.env.VITE_CONNECT ?? 'https://connect.myunraid.net');
const CONNECT_FORUMS = new URL('/forum/94-connect-plugin-support/', FORUMS);
const CONTACT = new URL('/contact', UNRAID_NET);
const DISCORD = new URL('https://discord.unraid.net');
const PURCHASE_CALLBACK = new URL('/c', UNRAID_NET);
const UNRAID_NET_SUPPORT = new URL('/support', UNRAID_NET);
const WEBGUI = new URL(import.meta.env.VITE_WEBGUI ?? window.location.origin);
const WEBGUI_GRAPHQL = new URL('/graphql', WEBGUI);
const WEBGUI_SETTINGS_MANAGMENT_ACCESS = new URL('/Settings/ManagementAccess', WEBGUI);
const WEBGUI_CONNECT_SETTINGS = new URL('#UnraidNetSettings', WEBGUI_SETTINGS_MANAGMENT_ACCESS);
const WEBGUI_TOOLS_DOWNGRADE = new URL('/Tools/Downgrade', WEBGUI);
const WEBGUI_TOOLS_REGISTRATION = new URL('/Tools/Registration', WEBGUI);
const WEBGUI_TOOLS_UPDATE = new URL('/Tools/Update', WEBGUI);
const OS_RELEASES = new URL(import.meta.env.VITE_OS_RELEASES ?? 'https://releases.unraid.net/os');
const DOCS_RELEASE_NOTES = new URL('/go/release-notes/', DOCS);
/**
* @param version - An Unraid OS version string (x.x.x-suffix).
* Suffix indicates special releases, such as RCs or betas.
* @returns A URL object pointing to the release notes for the specified Unraid OS version.
*/
const getReleaseNotesUrl = (version: string): URL => {
const osVersion = version.split('-')[0];
return new URL(`/unraid-os/release-notes/${osVersion}`, DOCS);
}
const DOCS_REGISTRATION_LICENSING = new URL('/go/faq-licensing/', DOCS);
const DOCS_REGISTRATION_REPLACE_KEY = new URL('/go/changing-the-flash-device/', DOCS);
const SUPPORT = new URL('https://unraid.net');
export const allowedDocsOriginRegex = /^https:\/\/(?:[\w-]+\.)*docs\.unraid\.net(?::\d+)?$/;
export const allowedDocsUrlRegex = /^https:\/\/(?:[\w-]+\.)*docs\.unraid\.net(?::\d+)?\//;
export {
ACCOUNT,
ACCOUNT_CALLBACK,
CONNECT_DASHBOARD,
CONNECT_DOCS,
CONNECT_FORUMS,
CONTACT,
DISCORD,
FORUMS,
FORUMS_BUG_REPORT,
PURCHASE_CALLBACK,
OS_RELEASES,
DOCS,
DOCS_RELEASE_NOTES,
getReleaseNotesUrl,
DOCS_REGISTRATION_LICENSING,
DOCS_REGISTRATION_REPLACE_KEY,
WEBGUI,
WEBGUI_CONNECT_SETTINGS,
WEBGUI_GRAPHQL,
WEBGUI_SETTINGS_MANAGMENT_ACCESS,
WEBGUI_TOOLS_DOWNGRADE,
WEBGUI_TOOLS_REGISTRATION,
WEBGUI_TOOLS_UPDATE,
SUPPORT,
UNRAID_NET_SUPPORT,
};