Skip to content

Commit 5655efd

Browse files
author
jorgen
committed
chore: better demo
1 parent 2cd3913 commit 5655efd

File tree

6 files changed

+15
-16
lines changed

6 files changed

+15
-16
lines changed

src/components/AmountInput/AmountInput.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,13 @@ import { Tooltip } from "components/Tooltip";
99
import { Input, InputGroup } from "components/Input";
1010
import { useTokenConversion } from "hooks/useTokenConversion";
1111
import {
12-
formatUnitsWithMaxFractions,
12+
QUERIESV2,
1313
formatUSD,
14+
formatUnitsWithMaxFractions,
1415
getToken,
1516
isNumberEthersParseable,
1617
parseUnits,
17-
QUERIESV2,
1818
} from "utils";
19-
import { useFeatureFlag } from "../../hooks";
2019

2120
export type Props = {
2221
balance?: BigNumber;
@@ -51,8 +50,6 @@ export function AmountInput({
5150
}: Props) {
5251
const token = getToken(inputTokenSymbol);
5352

54-
const hasDemoFlag = useFeatureFlag("demo-flag");
55-
5653
const validationLevel =
5754
(amountInput ?? "") === ""
5855
? "valid"
@@ -96,7 +93,7 @@ export function AmountInput({
9693
<Input
9794
type="number"
9895
validationLevel={validationLevel}
99-
placeholder={hasDemoFlag ? "WORKS!" : "Enter amount. NOT"}
96+
placeholder="Enter amount"
10097
value={amountInput}
10198
onWheel={(e) => e.currentTarget.blur()}
10299
onChange={(e) => {

src/components/LayoutV2/LayoutV2.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import styled from "@emotion/styled";
22
import Footer from "components/Footer";
33
import { QUERIESV2 } from "utils";
4+
import { useFeatureFlag } from "../../hooks";
45

56
type LayoutProp = {
67
maxWidth?: number;
@@ -13,21 +14,22 @@ const LayoutV2 = ({
1314
children,
1415
transparentBackground,
1516
}: LayoutProp) => {
17+
const hasDemoFlag = useFeatureFlag("demo-flag");
1618
return (
17-
<Wrapper transparentBackground={transparentBackground}>
19+
<Wrapper transparentBackground={transparentBackground} demo={hasDemoFlag}>
1820
<InnerWrapper maxWidth={maxWidth ?? 600}>{children}</InnerWrapper>
1921
<Footer />
2022
</Wrapper>
2123
);
2224
};
2325

24-
const Wrapper = styled.div<{ transparentBackground?: boolean }>`
26+
const Wrapper = styled.div<{ transparentBackground?: boolean; demo: boolean }>`
2527
display: flex;
2628
flex-direction: column;
2729
justify-content: space-between;
2830
29-
background-color: ${({ transparentBackground }) =>
30-
transparentBackground ? "transparent" : "#2d2e33"};
31+
background-color: ${({ transparentBackground, demo }) =>
32+
demo ? "#bada55" : transparentBackground ? "transparent" : "#2d2e33"};
3133
3234
/* Subtract to account for header */
3335
min-height: calc(100vh - 72px);

src/hooks/feature-flags/featureFlagsProvider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export function FeatureFlagsProvider({ children }: { children: ReactNode }) {
2424
publicDeploymentKey,
2525
{}
2626
);
27-
// set flags from localstorage before a fetch is initialized
27+
// set flags from localstorage cache before a fetch is initialized
2828
setFlags(experimentClientRef.current.all());
2929
setIsInitialized(true);
3030
}, []);

src/hooks/feature-flags/useFeatureFlags.tsx renamed to src/hooks/feature-flags/useFeatureFlagsContext.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useContext } from "react";
22
import { FeatureFlagsContext } from "./featureFlagsContext";
33

4-
export const useFeatureFlags = () => {
4+
export const useFeatureFlagsContext = () => {
55
const context = useContext(FeatureFlagsContext);
66
if (!context) {
77
throw new Error("useFeatureFlags must be used within FeatureFlagsProvider");

src/hooks/useInitialUserPropTraces.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ import {
88
setUserId,
99
} from "utils/amplitude";
1010
import { ampli } from "ampli";
11-
import { useFeatureFlags } from "./feature-flags/useFeatureFlags";
11+
import { useFeatureFlagsContext } from "./feature-flags/useFeatureFlagsContext";
1212

1313
export function useInitialUserPropTraces(isAmpliLoaded: boolean) {
14-
const { fetchFlags } = useFeatureFlags();
14+
const { fetchFlags } = useFeatureFlagsContext();
1515
const [areInitialUserPropsSet, setAreInitialUserPropsSet] = useState(false);
1616
const [prevTrackedAccount, setPrevTrackedAccount] = useState<
1717
string | undefined

src/hooks/useLoadAmpli.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ import {
88
isAmplitudeLoggingEnabled,
99
isProductionBuild,
1010
} from "utils";
11-
import { useFeatureFlags } from "./feature-flags/useFeatureFlags";
11+
import { useFeatureFlagsContext } from "./feature-flags/useFeatureFlagsContext";
1212

1313
export function useLoadAmpli() {
1414
const [isAmpliLoaded, setIsAmpliLoaded] = useState(false);
15-
const { initializeFeatureFlags } = useFeatureFlags();
15+
const { initializeFeatureFlags } = useFeatureFlagsContext();
1616

1717
useEffect(() => {
1818
if (amplitudeAPIKey && !isAmpliLoaded) {

0 commit comments

Comments
 (0)