This is an automated email from the ASF dual-hosted git repository.

shuai pushed a commit to branch feat/1.4.3/ui
in repository https://gitbox.apache.org/repos/asf/incubator-answer.git

commit afff5cb0eb9a7d9a751863e722a52ee834c7f8fd
Author: shuai <[email protected]>
AuthorDate: Thu Dec 12 10:52:10 2024 +0800

    fix: view icon replacement
---
 ui/package.json                    |  2 +-
 ui/pnpm-lock.yaml                  | 23 +++++++++++++----------
 ui/src/common/color.scss           | 12 ++++++++++++
 ui/src/components/Counts/index.tsx | 17 ++++++++++++++---
 ui/src/index.scss                  | 14 ++++++++++++++
 ui/src/stores/branding.ts          |  2 +-
 ui/src/stores/commentReply.ts      |  2 +-
 ui/src/stores/customize.ts         |  2 +-
 ui/src/stores/errorCode.ts         |  2 +-
 ui/src/stores/interface.ts         |  2 +-
 ui/src/stores/loggedUserInfo.ts    |  2 +-
 ui/src/stores/loginSetting.ts      |  2 +-
 ui/src/stores/loginToContinue.ts   |  2 +-
 ui/src/stores/pageTags.ts          |  2 +-
 ui/src/stores/seoSetting.ts        |  2 +-
 ui/src/stores/sideNav.ts           |  2 +-
 ui/src/stores/siteInfo.ts          |  2 +-
 ui/src/stores/themeSetting.ts      |  2 +-
 ui/src/stores/toast.ts             |  2 +-
 ui/src/stores/userCenter.ts        |  2 +-
 ui/src/stores/writeSetting.ts      |  2 +-
 ui/template/question.html          |  2 +-
 ui/template/tag-detail.html        |  2 +-
 23 files changed, 72 insertions(+), 32 deletions(-)

diff --git a/ui/package.json b/ui/package.json
index 2840b9b5..31920c1b 100644
--- a/ui/package.json
+++ b/ui/package.json
@@ -45,7 +45,7 @@
     "react-router-dom": "^6.22.3",
     "semver": "^7.3.8",
     "swr": "^1.3.0",
-    "zustand": "^4.1.1"
+    "zustand": "^5.0.2"
   },
   "devDependencies": {
     "@commitlint/cli": "^17.0.3",
diff --git a/ui/pnpm-lock.yaml b/ui/pnpm-lock.yaml
index 8a9622ef..aa4f45cf 100644
--- a/ui/pnpm-lock.yaml
+++ b/ui/pnpm-lock.yaml
@@ -96,8 +96,8 @@ importers:
         specifier: ^1.3.0
         version: 1.3.0([email protected])
       zustand:
-        specifier: ^4.1.1
-        version: 4.5.5(@types/[email protected])([email protected])([email protected])
+        specifier: ^5.0.2
+        version: 
5.0.2(@types/[email protected])([email protected])([email protected])([email protected]([email protected]))
     devDependencies:
       '@commitlint/cli':
         specifier: ^17.0.3
@@ -6898,13 +6898,14 @@ packages:
     resolution: {integrity: 
sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==}
     engines: {node: '>=10'}
 
-  [email protected]:
-    resolution: {integrity: 
sha512-+0PALYNJNgK6hldkgDq2vLrw5f6g/jCInz52n9RTpropGgeAf/ioFUCdtsjCqu4gNhW9D01rUQBROoRjdzyn2Q==}
-    engines: {node: '>=12.7.0'}
+  [email protected]:
+    resolution: {integrity: 
sha512-8qNdnJVJlHlrKXi50LDqqUNmUbuBjoKLrYQBnoChIbVph7vni+sY+YpvdjXG9YLd/Bxr6scMcR+rm5H3aSqPaw==}
+    engines: {node: '>=12.20.0'}
     peerDependencies:
-      '@types/react': '>=16.8'
+      '@types/react': '>=18.0.0'
       immer: '>=9.0.6'
-      react: '>=16.8'
+      react: '>=18.0.0'
+      use-sync-external-store: '>=1.2.0'
     peerDependenciesMeta:
       '@types/react':
         optional: true
@@ -6912,6 +6913,8 @@ packages:
         optional: true
       react:
         optional: true
+      use-sync-external-store:
+        optional: true
 
 snapshots:
 
@@ -14650,6 +14653,7 @@ snapshots:
   [email protected]([email protected]):
     dependencies:
       react: 18.3.1
+    optional: true
 
   [email protected]: {}
 
@@ -15119,10 +15123,9 @@ snapshots:
 
   [email protected]: {}
 
-  [email protected](@types/[email protected])([email protected])([email protected]):
-    dependencies:
-      use-sync-external-store: 1.2.2([email protected])
+  
[email protected](@types/[email protected])([email protected])([email protected])([email protected]([email protected])):
     optionalDependencies:
       '@types/react': 18.3.16
       immer: 9.0.21
       react: 18.3.1
+      use-sync-external-store: 1.2.2([email protected])
diff --git a/ui/src/common/color.scss b/ui/src/common/color.scss
index 16a7a297..a2dd55fc 100644
--- a/ui/src/common/color.scss
+++ b/ui/src/common/color.scss
@@ -125,4 +125,16 @@
     }
   }
 
+  .view-level1 {
+    color: $orange-300;
+  }
+
+  .view-level2 {
+    color: $orange-200;
+  }
+
+  .view-level3 {
+    color: $orange-100;
+  }
+
 }
diff --git a/ui/src/components/Counts/index.tsx 
b/ui/src/components/Counts/index.tsx
index 3b5fbe3a..aefaad11 100644
--- a/ui/src/components/Counts/index.tsx
+++ b/ui/src/components/Counts/index.tsx
@@ -23,6 +23,7 @@ import { useTranslation } from 'react-i18next';
 import classname from 'classnames';
 
 import { Icon } from '@/components';
+import { formatCount } from '@/utils/common';
 
 interface Props {
   data: {
@@ -82,10 +83,20 @@ const Index: FC<Props> = ({
         </div>
       )}
       {showViews && (
-        <span className="summary-stat ms-3 flex-shrink-0">
-          <Icon name="eye-fill" />
+        <span
+          className={classname(
+            'summary-stat ms-3 flex-shrink-0',
+            data.views >= 100 * 1000
+              ? 'view-level3'
+              : data.views >= 1000
+                ? 'view-level2'
+                : data.views >= 100
+                  ? 'view-level1'
+                  : '',
+          )}>
+          <Icon name="bar-chart-fill" />
           <em className="fst-normal ms-1">
-            {data.views} {t('views')}
+            {formatCount(data.views)} {t('views')}
           </em>
         </span>
       )}
diff --git a/ui/src/index.scss b/ui/src/index.scss
index 7586e9a1..7e9b8a6f 100644
--- a/ui/src/index.scss
+++ b/ui/src/index.scss
@@ -356,3 +356,17 @@ img[src=""] {
 .gold {
   color: #FFD700;
 }
+
+
+
+.view-level1 {
+  color: $orange-600;
+}
+
+.view-level2 {
+  color: $orange-700;
+}
+
+.view-level3 {
+  color: $orange-800;
+}
diff --git a/ui/src/stores/branding.ts b/ui/src/stores/branding.ts
index 731e9c7d..958da75d 100644
--- a/ui/src/stores/branding.ts
+++ b/ui/src/stores/branding.ts
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-import create from 'zustand';
+import { create } from 'zustand';
 
 import { AdminSettingBranding } from '@/common/interface';
 
diff --git a/ui/src/stores/commentReply.ts b/ui/src/stores/commentReply.ts
index f654b8fd..fc9f355b 100644
--- a/ui/src/stores/commentReply.ts
+++ b/ui/src/stores/commentReply.ts
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-import create from 'zustand';
+import { create } from 'zustand';
 
 interface CommentReplyType {
   id: string | number;
diff --git a/ui/src/stores/customize.ts b/ui/src/stores/customize.ts
index d46cf108..d6a729f6 100644
--- a/ui/src/stores/customize.ts
+++ b/ui/src/stores/customize.ts
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-import create from 'zustand';
+import { create } from 'zustand';
 
 interface IType {
   custom_css: string;
diff --git a/ui/src/stores/errorCode.ts b/ui/src/stores/errorCode.ts
index f537e641..8e928bab 100644
--- a/ui/src/stores/errorCode.ts
+++ b/ui/src/stores/errorCode.ts
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-import create from 'zustand';
+import { create } from 'zustand';
 
 type codeType = '403' | '404' | '50X' | '';
 
diff --git a/ui/src/stores/interface.ts b/ui/src/stores/interface.ts
index 33df5514..7b514eb6 100644
--- a/ui/src/stores/interface.ts
+++ b/ui/src/stores/interface.ts
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-import create from 'zustand';
+import { create } from 'zustand';
 
 import { AdminSettingsInterface } from '@/common/interface';
 import { DEFAULT_LANG } from '@/common/constants';
diff --git a/ui/src/stores/loggedUserInfo.ts b/ui/src/stores/loggedUserInfo.ts
index 806c0993..9cdb9944 100644
--- a/ui/src/stores/loggedUserInfo.ts
+++ b/ui/src/stores/loggedUserInfo.ts
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-import create from 'zustand';
+import { create } from 'zustand';
 
 import type { UserInfoRes } from '@/common/interface';
 import Storage from '@/utils/storage';
diff --git a/ui/src/stores/loginSetting.ts b/ui/src/stores/loginSetting.ts
index 15d572f1..73fd4880 100644
--- a/ui/src/stores/loginSetting.ts
+++ b/ui/src/stores/loginSetting.ts
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-import create from 'zustand';
+import { create } from 'zustand';
 
 import { AdminSettingsLogin } from '@/common/interface';
 
diff --git a/ui/src/stores/loginToContinue.ts b/ui/src/stores/loginToContinue.ts
index 0d44d3b5..e3268d17 100644
--- a/ui/src/stores/loginToContinue.ts
+++ b/ui/src/stores/loginToContinue.ts
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-import create from 'zustand';
+import { create } from 'zustand';
 
 interface IProps {
   show: boolean;
diff --git a/ui/src/stores/pageTags.ts b/ui/src/stores/pageTags.ts
index 4ab3df7a..72c76a3c 100644
--- a/ui/src/stores/pageTags.ts
+++ b/ui/src/stores/pageTags.ts
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-import create from 'zustand';
+import { create } from 'zustand';
 
 import { HelmetBase, HelmetUpdate } from '@/common/interface';
 
diff --git a/ui/src/stores/seoSetting.ts b/ui/src/stores/seoSetting.ts
index c50085bd..41fa73a4 100644
--- a/ui/src/stores/seoSetting.ts
+++ b/ui/src/stores/seoSetting.ts
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-import create from 'zustand';
+import { create } from 'zustand';
 
 import { AdminSettingsSeo } from '@/common/interface';
 
diff --git a/ui/src/stores/sideNav.ts b/ui/src/stores/sideNav.ts
index 1d1a7a29..fd164ee1 100644
--- a/ui/src/stores/sideNav.ts
+++ b/ui/src/stores/sideNav.ts
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-import create from 'zustand';
+import { create } from 'zustand';
 
 type reviewData = {
   can_revision: boolean;
diff --git a/ui/src/stores/siteInfo.ts b/ui/src/stores/siteInfo.ts
index b7f31406..5208b9b4 100644
--- a/ui/src/stores/siteInfo.ts
+++ b/ui/src/stores/siteInfo.ts
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-import create from 'zustand';
+import { create } from 'zustand';
 
 import { AdminSettingsGeneral, AdminSettingsUsers } from '@/common/interface';
 import { DEFAULT_SITE_NAME } from '@/common/constants';
diff --git a/ui/src/stores/themeSetting.ts b/ui/src/stores/themeSetting.ts
index dde9c91e..c48d9adf 100644
--- a/ui/src/stores/themeSetting.ts
+++ b/ui/src/stores/themeSetting.ts
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-import create from 'zustand';
+import { create } from 'zustand';
 
 import { AdminSettingsTheme } from '@/common/interface';
 import { DEFAULT_THEME_COLOR } from '@/common/constants';
diff --git a/ui/src/stores/toast.ts b/ui/src/stores/toast.ts
index 274372e1..c15c515c 100644
--- a/ui/src/stores/toast.ts
+++ b/ui/src/stores/toast.ts
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-import create from 'zustand';
+import { create } from 'zustand';
 
 type Variant = 'warning' | 'success' | 'danger';
 interface ToastStore {
diff --git a/ui/src/stores/userCenter.ts b/ui/src/stores/userCenter.ts
index f3610374..8eef642d 100644
--- a/ui/src/stores/userCenter.ts
+++ b/ui/src/stores/userCenter.ts
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-import create from 'zustand';
+import { create } from 'zustand';
 
 import type { UcAgent } from '@/services/user-center';
 
diff --git a/ui/src/stores/writeSetting.ts b/ui/src/stores/writeSetting.ts
index f3a5613c..ec0ae1eb 100644
--- a/ui/src/stores/writeSetting.ts
+++ b/ui/src/stores/writeSetting.ts
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-import create from 'zustand';
+import { create } from 'zustand';
 
 import { AdminSettingsWrite } from '@/common/interface';
 
diff --git a/ui/template/question.html b/ui/template/question.html
index ca7f1301..198802e6 100644
--- a/ui/template/question.html
+++ b/ui/template/question.html
@@ -71,7 +71,7 @@
                   <em class="fst-normal ms-1">{{.AnswerCount}}</em>
                 </div>
                 <span class="summary-stat ms-3">
-                  <i class="br bi-eye-fill"></i>
+                  <i class="br bi-bar-chart-fill"></i>
                   <em class="fst-normal ms-1">{{.ViewCount}}</em>
                 </span>
               </div>
diff --git a/ui/template/tag-detail.html b/ui/template/tag-detail.html
index a2e31498..f9460411 100644
--- a/ui/template/tag-detail.html
+++ b/ui/template/tag-detail.html
@@ -70,7 +70,7 @@
                   <em class="fst-normal ms-1">{{.AnswerCount}}</em>
                 </div>
                 <span class="summary-stat ms-3 flex-shrink-0">
-                  <i class="br bi-eye-fill"></i>
+                  <i class="br bi-bar-chart-fill"></i>
                   <em class="fst-normal ms-1">{{.ViewCount}}</em>
                 </span>
               </div>

Reply via email to