From 82eaca400ffe584b0fcd2f1f6f24f796d3d92a7e Mon Sep 17 00:00:00 2001 From: Zack Spear Date: Wed, 9 Jul 2025 12:02:27 -0700 Subject: [PATCH] refactor: streamline trial message logic in server store Consolidated trial message handling to reduce redundancy and improve readability. The logic now checks conditions for trial expiration and extension eligibility more efficiently, ensuring users receive accurate information based on their trial status. --- web/store/server.ts | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/web/store/server.ts b/web/store/server.ts index 8dcb265a3..c490aa5e2 100644 --- a/web/store/server.ts +++ b/web/store/server.ts @@ -511,20 +511,14 @@ export const useServerStore = defineStore('server', () => { '

Choose an option below, then use our Getting Started Guide to configure your array in less than 15 minutes.

', }; case 'TRIAL': - trialMessage = '

Your Trial key includes all the functionality and device support of an Unleashed key.

'; - - if (trialWithin5DaysOfExpiration.value) { - if (trialExtensionEligible.value) { - trialMessage += '

Your trial is expiring soon. When it expires, the array will stop. You may extend your trial now, purchase a license key, or wait until expiration to take action.

'; - } else { - trialMessage += '

Your trial is expiring soon and you have used all available extensions. When it expires, the array will stop. To continue using Unraid OS, you must purchase a license key.

'; - } + if (trialWithin5DaysOfExpiration.value && trialExtensionEligible.value) { + trialMessage = '

Your Trial key includes all the functionality and device support of an Unleashed key.

Your trial is expiring soon. When it expires, the array will stop. You may extend your trial now, purchase a license key, or wait until expiration to take action.

'; + } else if (trialWithin5DaysOfExpiration.value && !trialExtensionEligible.value) { + trialMessage = '

Your Trial key includes all the functionality and device support of an Unleashed key.

Your trial is expiring soon and you have used all available extensions. When it expires, the array will stop. To continue using Unraid OS, you must purchase a license key.

'; + } else if (!trialWithin5DaysOfExpiration.value && trialExtensionEligible.value) { + trialMessage = '

Your Trial key includes all the functionality and device support of an Unleashed key.

When your Trial expires, the array will stop. At that point you may either purchase a license key or request a Trial extension.

'; } else { - if (trialExtensionEligible.value) { - trialMessage += '

When your Trial expires, the array will stop. At that point you may either purchase a license key or request a Trial extension.

'; - } else { - trialMessage += '

You have used all available trial extensions. When your Trial expires, the array will stop. To continue using Unraid OS after expiration, you must purchase a license key.

'; - } + trialMessage = '

Your Trial key includes all the functionality and device support of an Unleashed key.

You have used all available trial extensions. When your Trial expires, the array will stop. To continue using Unraid OS after expiration, you must purchase a license key.

'; } return {