Files
api/web/components/WanIpCheck.ce.vue
T
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

88 lines
2.5 KiB
Vue

<script lang="ts" setup>
import { computed, onBeforeMount, ref, watchEffect } from 'vue';
import { useI18n } from 'vue-i18n';
import { storeToRefs } from 'pinia';
import { request } from '~/composables/services/request';
import { useServerStore } from '~/store/server';
export interface Props {
phpWanIp?: string;
}
const props = defineProps<Props>();
const { t } = useI18n();
const { isRemoteAccess } = storeToRefs(useServerStore());
const wanIp = ref<string | null>();
const fetchError = ref<string>('');
const loading = ref(false);
const computedError = computed((): string => {
if (!props.phpWanIp) {
return t('DNS issue, unable to resolve wanip4.unraid.net');
}
if (fetchError.value) {
return fetchError.value;
}
return '';
});
onBeforeMount(() => {
wanIp.value = sessionStorage.getItem('unraidConnect_wanIp');
});
watchEffect(async () => {
// if we don't have a client WAN IP AND we have the server WAN IP then we fetch
if (!wanIp.value && props.phpWanIp) {
loading.value = true;
const response = await request.url('https://wanip4.unraid.net/').get().text();
if (response) {
loading.value = false;
wanIp.value = response as string; // response returns text nothing to traverse
// save in sessionStorage so we only make this request once per webGUI session
sessionStorage.setItem('unraidConnect_wanIp', wanIp.value);
} else {
loading.value = false;
fetchError.value = t('Unable to fetch client WAN IPv4');
}
}
});
</script>
<template>
<div>
<span v-if="loading" class="italic">{{ t('Checking WAN IPs') }}</span>
<template v-else>
<span v-if="computedError" class="text-unraid-red font-semibold">{{ computedError }}</span>
<template v-else>
<span v-if="isRemoteAccess || (phpWanIp === wanIp && !isRemoteAccess)">{{
t('Remark: your WAN IPv4 is {0}', [wanIp])
}}</span>
<span v-else class="inline-block w-1/2 whitespace-normal">
{{
t("Remark: Unraid's WAN IPv4 {0} does not match your client's WAN IPv4 {1}.", [
phpWanIp,
wanIp,
])
}}
{{
t('This may indicate a complex network that will not work with this Remote Access solution.')
}}
{{ t('Ignore this message if you are currently connected via Remote Access or VPN.') }}
</span>
</template>
</template>
</div>
</template>
<style >
/* Import unraid-ui globals first */
@import '@unraid/ui/styles';
@import '~/assets/main.css';
</style>