Skip to content

Commit

Permalink
[autofix.ci] apply automated fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
autofix-ci[bot] authored Mar 28, 2024
1 parent 9d20888 commit ec342b4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ export default function FeatureList() {
{!quickActionBar.loading && (
<div className="flex items-center space-x-4 rounded-md border p-4">
<div className="flex-1 space-y-1">
<p className="text-sm font-medium leading-none">{quickActionBar.title}</p>
<p className="text-sm text-muted-foreground">{quickActionBar.description}</p>
<p className="text-sm font-medium leading-none">
{quickActionBar.title}
</p>
<p className="text-sm text-muted-foreground">
{quickActionBar.description}
</p>
</div>
<Switch
checked={quickActionBar.value}
Expand Down
19 changes: 12 additions & 7 deletions ee/tabby-ui/lib/experiment-flags.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { useEffect, useState } from 'react'

const useLocalStorageForExperimentFlag = (storageKey: string, defaultValue: boolean): [
boolean,
(value: boolean) => void,
boolean
] => {
const useLocalStorageForExperimentFlag = (
storageKey: string,
defaultValue: boolean
): [boolean, (value: boolean) => void, boolean] => {
const [storageValue, setStorageValue] = useState(defaultValue)
const [loading, setLoading] = useState(true)

Expand Down Expand Up @@ -50,7 +49,12 @@ class ExperimentFlagFactory {
private description: string
private defaultValue: boolean

constructor(storageKey: string, title: string, description: string, defaultValue?: boolean) {
constructor(
storageKey: string,
title: string,
description: string,
defaultValue?: boolean
) {
this.storageKey = `EXP_${storageKey}`
this.title = title
this.description = description
Expand All @@ -71,7 +75,8 @@ class ExperimentFlagFactory {
{ value: boolean; title: string; description: string; loading: boolean },
() => void
] => {
const [storageValue, setStorageValue, loading] = useLocalStorageForExperimentFlag(this.storageKey, this.defaultValue)
const [storageValue, setStorageValue, loading] =
useLocalStorageForExperimentFlag(this.storageKey, this.defaultValue)

const toggleFlag = () => {
setStorageValue(!storageValue)
Expand Down

0 comments on commit ec342b4

Please sign in to comment.