From 089207240e91104b1f8589e7be743481be04b422 Mon Sep 17 00:00:00 2001 From: NFish Date: Wed, 19 Feb 2025 13:44:35 +0800 Subject: [PATCH 1/4] fix: add offline notice --- web/app/components/sentry-initor.tsx | 12 ++++++++++++ web/i18n/en-US/common.ts | 1 + web/i18n/zh-Hans/common.ts | 1 + 3 files changed, 14 insertions(+) diff --git a/web/app/components/sentry-initor.tsx b/web/app/components/sentry-initor.tsx index 6bf0abbec2..8f31eb8969 100644 --- a/web/app/components/sentry-initor.tsx +++ b/web/app/components/sentry-initor.tsx @@ -2,12 +2,24 @@ import { useEffect } from 'react' import * as Sentry from '@sentry/react' +import { useTranslation } from 'react-i18next' +import Toast from './base/toast' +import { useDebounceEffect } from 'ahooks' const isDevelopment = process.env.NODE_ENV === 'development' const SentryInit = ({ children, }: { children: React.ReactElement }) => { + const { t } = useTranslation() + useDebounceEffect(() => { + Toast.notify({ + type: 'warning', + message: t('common.offlineNotice'), + duration: 60000, + className: 'fixed left-1/2 -translate-x-1/2', + }) + }, [t]) useEffect(() => { const SENTRY_DSN = document?.body?.getAttribute('data-public-sentry-dsn') if (!isDevelopment && SENTRY_DSN) { diff --git a/web/i18n/en-US/common.ts b/web/i18n/en-US/common.ts index 4e1d21d76b..bf6e7b3f98 100644 --- a/web/i18n/en-US/common.ts +++ b/web/i18n/en-US/common.ts @@ -1,4 +1,5 @@ const translation = { + offlineNotice: 'Dify v1.0.0 is now officially released. Effective February 24, 2025, the current environment will no longer be accessible, and all data will be permanently deleted. Please ensure that you back up any necessary data prior to this date to avoid any loss.', api: { success: 'Success', actionSuccess: 'Action succeeded', diff --git a/web/i18n/zh-Hans/common.ts b/web/i18n/zh-Hans/common.ts index 70a3a6985d..8445f009f8 100644 --- a/web/i18n/zh-Hans/common.ts +++ b/web/i18n/zh-Hans/common.ts @@ -1,4 +1,5 @@ const translation = { + offlineNotice: 'Dify v1.0.0 现已正式发布。自 2025年 2 月 24 日起,当前环境将不可访问,所有数据将被永久删除。请务必在此日期之前备份所有必要数据,以避免任何数据丢失。', api: { success: '成功', actionSuccess: '操作成功', From 782df0c383ddde3151d9d7a8594f57899bd35329 Mon Sep 17 00:00:00 2001 From: NFish Date: Wed, 19 Feb 2025 15:30:19 +0800 Subject: [PATCH 2/4] fix: update offline notice style --- web/app/components/base/toast/index.tsx | 2 +- web/app/components/sentry-initor.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/web/app/components/base/toast/index.tsx b/web/app/components/base/toast/index.tsx index 4526eaafcc..e24ab8a67b 100644 --- a/web/app/components/base/toast/index.tsx +++ b/web/app/components/base/toast/index.tsx @@ -59,7 +59,7 @@ const Toast = ({ }`} />
-
+
{type === 'success' &&