Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

refactor(web): replace MediaType enum with const object (#33834)

Desel726be7ba29287a
diff --git a/web/eslint-suppressions.json b/web/eslint-suppressions.json
index a645a408cf9..04e8be3afdc 100644
--- a/web/eslint-suppressions.json
+++ b/web/eslint-suppressions.json
@@ -9795,11 +9795,6 @@
"count": 6
}
},
- "hooks/use-breakpoints.ts": {
- "erasable-syntax-only/enums": {
- "count": 1
- }
- },
"hooks/use-format-time-from-now.spec.ts": {
"regexp/no-dupe-disjunctions": {
"count": 5
diff --git a/web/hooks/use-breakpoints.ts b/web/hooks/use-breakpoints.ts
index e0bd45c01c2..f31a335c5b2 100644
--- a/web/hooks/use-breakpoints.ts
+++ b/web/hooks/use-breakpoints.ts
@@ -1,13 +1,15 @@
'use client'
import * as React from 'react'
-export enum MediaType {
- mobile = 'mobile',
- tablet = 'tablet',
- pc = 'pc',
-}
+export const MediaType = {
+ mobile: 'mobile',
+ tablet: 'tablet',
+ pc: 'pc',
+} as const
+
+type MediaTypeValue = (typeof MediaType)[keyof typeof MediaType]
-const useBreakpoints = () => {
+const useBreakpoints = (): MediaTypeValue => {
const [width, setWidth] = React.useState(globalThis.innerWidth)
const media = (() => {
if (width <= 640)