Compare commits

..
Author SHA1 Message Date
Bill He 2a3e0ac618 add to readme 2024-02-06 21:39:14 -08:00
Bill He 707db7b111 string 2024-02-06 10:13:55 -08:00
Bill He 8c759997d1 Add custom amplitude server URL 2024-02-06 10:00:01 -08:00
21 changed files with 70 additions and 55 deletions
+1
View File
@@ -8,6 +8,7 @@ VITE_V3_TOKEN_ADDRESS=
VITE_TOKEN_MIGRATION_URI=
AMPLITUDE_API_KEY=
AMPLITUDE_SERVER_URL=
BUGSNAG_API_KEY=
IOS_APP_ID=
INTERCOM_APP_ID=
+1
View File
@@ -78,6 +78,7 @@ Set environment variables via `.env`.
- `VITE_V3_TOKEN_ADDRESS` (optional): Address of the V3 $DYDX token.
- `VITE_TOKEN_MIGRATION_URI` (optional): The URL of the token migration website.
- `AMPLITUDE_API_KEY` (optional): Amplitude API key for enabling Amplitude; used with `pnpm run build:inject-amplitude`.
- `AMPLITUDE_SERVER_URL` (optional): Custom Amplitude server URL
- `BUGSNAG_API_KEY` (optional): API key for enabling Bugsnag; used with `pnpm run build:inject-bugsnag`.
- `IOS_APP_ID` (optional): iOS app ID used for enabling deep linking to the iOS app; used with `pnpm run build:inject-app-deeplinks`.
- `INTERCOM_APP_ID` (optional): Used for enabling Intercom; utilized with `pnpm run build:inject-intercom`.
+1 -1
View File
@@ -41,7 +41,7 @@
"@cosmjs/tendermint-rpc": "^0.32.1",
"@dydxprotocol/v4-abacus": "^1.4.2",
"@dydxprotocol/v4-client-js": "^1.0.20",
"@dydxprotocol/v4-localization": "^1.1.24",
"@dydxprotocol/v4-localization": "^1.1.22",
"@ethersproject/providers": "^5.7.2",
"@js-joda/core": "^5.5.3",
"@radix-ui/react-accordion": "^1.1.2",
+4 -4
View File
@@ -32,8 +32,8 @@ dependencies:
specifier: ^1.0.20
version: 1.0.20
'@dydxprotocol/v4-localization':
specifier: ^1.1.24
version: 1.1.24
specifier: ^1.1.22
version: 1.1.22
'@ethersproject/providers':
specifier: ^5.7.2
version: 5.7.2
@@ -1121,8 +1121,8 @@ packages:
- utf-8-validate
dev: false
/@dydxprotocol/v4-localization@1.1.24:
resolution: {integrity: sha512-75XpxxYTpy8eIFcJINyLlvw5J93t0TrS5LacE6J5Raz9LOUWRK4VyRbdLCU2QX8AG7xiTZk1ma8ytylVZOVx3A==}
/@dydxprotocol/v4-localization@1.1.22:
resolution: {integrity: sha512-DURyvBx0qjXmtebSRMW4ZdTsX5xI8Mb6c7LQ8WUPU0O3Jr7n7iUT/phzZszTpwNOMFFMukMFtn7fHCgijw1TOg==}
dev: false
/@dydxprotocol/v4-proto@4.0.0-dev.0:
+30 -3
View File
@@ -3,12 +3,13 @@ import path from 'path';
import { fileURLToPath } from 'url';
const AMPLITUDE_API_KEY = process.env.AMPLITUDE_API_KEY;
const AMPLITUDE_SERVER_URL = process.env.AMPLITUDE_SERVER_URL;
const currentPath = fileURLToPath(import.meta.url);
const projectRoot = path.dirname(currentPath);
const htmlFilePath = path.resolve(projectRoot, '../dist/index.html');
if(AMPLITUDE_API_KEY){
if (AMPLITUDE_API_KEY) {
try {
const html = await fs.readFile(htmlFilePath, 'utf-8');
@@ -18,8 +19,34 @@ if(AMPLITUDE_API_KEY){
`;
const amplitudeListenerScript = `<script type="module">
!function(){var e="${AMPLITUDE_API_KEY}";e&&(globalThis.amplitude.init(e),globalThis.amplitude.setOptOut(!1),globalThis.addEventListener("dydx:track",function(e){var t=e.detail.eventType,d=e.detail.eventData;globalThis.amplitude.track(t,d)}),globalThis.addEventListener("dydx:identify",function(e){var t=e.detail.property,d=e.detail.propertyValue;if("walletAddress"===t)globalThis.amplitude.setUserId(d);else{var i=new globalThis.amplitude.Identify;i.set(t,d),globalThis.amplitude.identify(i)}}),console.log("Amplitude enabled."))}();
</script>`;
!(function () {
var e = "${AMPLITUDE_API_KEY}";
e &&
(globalThis.amplitude.init(e${
AMPLITUDE_SERVER_URL
? `, undefined, {
serverUrl: "${AMPLITUDE_SERVER_URL}"
}`
: ''
}),
globalThis.amplitude.setOptOut(!1),
globalThis.addEventListener("dydx:track", function (e) {
var t = e.detail.eventType,
d = e.detail.eventData;
globalThis.amplitude.track(t, d);
}),
globalThis.addEventListener("dydx:identify", function (e) {
var t = e.detail.property,
d = e.detail.propertyValue;
if ("walletAddress" === t) globalThis.amplitude.setUserId(d);
else {
var i = new globalThis.amplitude.Identify();
i.set(t, d), globalThis.amplitude.identify(i);
}
}),
console.log("Amplitude enabled."));
})();
</script>`;
const injectedHtml = html.replace(
'<div id="root"></div>',
+3
View File
@@ -40,6 +40,9 @@ const AlertContainer = styled.div<StyleProps>`
case AlertType.Info: {
return css`
--alert-accent-color: var(--color-text-1);
--alert-default-background-opacity: 0.133; // Relative
// --alert-background: var(--color-layer-6); // Absolute
`;
}
case AlertType.Success: {
+3 -3
View File
@@ -103,14 +103,14 @@ const buttonActionVariants = {
[ButtonAction.Create]: css`
--button-textColor: var(--color-text-button);
--button-backgroundColor: var(--color-green);
--button-backgroundColor: var(--color-success);
--button-border: solid var(--border-width) var(--color-border-white);
--button-hover-filter: brightness(var(--hover-filter-variant));
`,
[ButtonAction.Destroy]: css`
--button-textColor: var(--color-text-button);
--button-backgroundColor: var(--color-red);
--button-backgroundColor: var(--color-error);
--button-border: solid var(--border-width) var(--color-border-white);
--button-hover-filter: brightness(var(--hover-filter-variant));
`,
@@ -122,7 +122,7 @@ const buttonActionVariants = {
`,
[ButtonAction.Reset]: css`
--button-textColor: var(--color-red);
--button-textColor: var(--color-error);
--button-backgroundColor: var(--color-layer-3);
--button-border: solid var(--border-width) var(--color-border-red);
--button-hover-filter: brightness(var(--hover-filter-variant));
+2 -2
View File
@@ -91,10 +91,10 @@ Styled.Item = styled(Item)<{ $highlightColor: 'accent' | 'create' | 'destroy' }>
--item-highlighted-textColor: var(--color-accent);
`,
['create']: `
--item-highlighted-textColor: var(--color-green);
--item-highlighted-textColor: var(--color-success);
`,
['destroy']: `
--item-highlighted-textColor: var(--color-red);
--item-highlighted-textColor: var(--color-error);
`,
}[$highlightColor])}
+1 -1
View File
@@ -47,7 +47,7 @@ Styled.Root = styled(Root)`
--switch-thumb-backgroundColor: var(--color-layer-6);
--switch-active-backgroundColor: var(--color-accent);
--switch-active-thumb-backgroundColor: var(--color-white);
--switch-active-thumb-backgroundColor: ${({ theme }) => theme.switchThumbActiveBackground};
position: relative;
width: var(--switch-width);
+2 -2
View File
@@ -117,7 +117,7 @@ Styled.ConfirmButton = styled(Styled.IconButton)`
--button-backgroundColor: hsla(203, 25%, 19%, 1);
svg {
color: var(--color-green);
color: var(--color-success);
}
`;
@@ -125,7 +125,7 @@ Styled.CancelButton = styled(Styled.IconButton)`
--button-backgroundColor: hsla(296, 16%, 18%, 1);
svg {
color: var(--color-red);
color: var(--color-error);
width: 0.8em;
height: 0.8em;
+2 -8
View File
@@ -5,8 +5,7 @@ export type Theme = {
[AppColorMode.RedUp]: ThemeColorBase;
};
export type ThemeColorBase = BaseColors &
LayerColors &
export type ThemeColorBase = LayerColors &
BorderColors &
TextColors &
GradientColors &
@@ -18,12 +17,6 @@ export type ThemeColorBase = BaseColors &
ComponentColors &
Filters;
type BaseColors = {
white: string;
green: string;
red: string;
};
type LayerColors = {
layer0: string;
layer1: string;
@@ -93,6 +86,7 @@ type IconColors = {
type ComponentColors = {
inputBackground: string;
popoverBackground: string;
switchThumbActiveBackground: string;
toggleBackground: string;
tooltipBackground: string;
};
+1 -1
View File
@@ -335,7 +335,7 @@ Styled.ActionButton = styled(IconButton)<{ iconName?: IconName }>`
${({ iconName }) =>
iconName === IconName.Close
? css`
--button-textColor: var(--color-red);
--button-textColor: var(--color-error);
--button-icon-size: 0.75em;
`
: iconName === IconName.Transfer &&
-4
View File
@@ -2,10 +2,6 @@ import { createGlobalStyle } from 'styled-components';
export const GlobalStyle = createGlobalStyle`
:root {
--color-white: ${({ theme }) => theme.white};
--color-green: ${({ theme }) => theme.green};
--color-red: ${({ theme }) => theme.red};
--color-layer-0: ${({ theme }) => theme.layer0};
--color-layer-1: ${({ theme }) => theme.layer1};
--color-layer-2: ${({ theme }) => theme.layer2};
+3 -12
View File
@@ -4,10 +4,6 @@ import { BrightnessFilterToken, ColorToken, OpacityToken } from '@/constants/sty
import { generateFadedColorVariant } from '@/lib/styles';
const ClassicThemeBase: ThemeColorBase = {
white: ColorToken.White,
green: ColorToken.Green1,
red: ColorToken.Red2,
layer0: ColorToken.GrayBlue7,
layer1: ColorToken.GrayBlue6,
layer2: ColorToken.GrayBlue5,
@@ -55,6 +51,7 @@ const ClassicThemeBase: ThemeColorBase = {
inputBackground: ColorToken.GrayBlue3,
popoverBackground: generateFadedColorVariant(ColorToken.GrayBlue4, OpacityToken.Opacity90),
switchThumbActiveBackground: ColorToken.White,
toggleBackground: ColorToken.GrayBlue3,
tooltipBackground: generateFadedColorVariant(ColorToken.GrayBlue3, OpacityToken.Opacity66),
@@ -64,10 +61,6 @@ const ClassicThemeBase: ThemeColorBase = {
};
const DarkThemeBase: ThemeColorBase = {
white: ColorToken.White,
green: ColorToken.Green0,
red: ColorToken.Red0,
layer0: ColorToken.Black,
layer1: ColorToken.DarkGray11,
layer2: ColorToken.DarkGray13,
@@ -115,6 +108,7 @@ const DarkThemeBase: ThemeColorBase = {
inputBackground: ColorToken.DarkGray6,
popoverBackground: generateFadedColorVariant(ColorToken.DarkGray8, OpacityToken.Opacity90),
switchThumbActiveBackground: ColorToken.White,
toggleBackground: ColorToken.DarkGray6,
tooltipBackground: generateFadedColorVariant(ColorToken.DarkGray6, OpacityToken.Opacity66),
@@ -124,10 +118,6 @@ const DarkThemeBase: ThemeColorBase = {
};
const LightThemeBase: ThemeColorBase = {
white: ColorToken.White,
green: ColorToken.Green2,
red: ColorToken.Red1,
layer0: ColorToken.White,
layer1: ColorToken.LightGray6,
layer2: ColorToken.White,
@@ -175,6 +165,7 @@ const LightThemeBase: ThemeColorBase = {
inputBackground: ColorToken.White,
popoverBackground: generateFadedColorVariant(ColorToken.LightGray8, OpacityToken.Opacity90),
switchThumbActiveBackground: ColorToken.White,
toggleBackground: ColorToken.LightGray4,
tooltipBackground: generateFadedColorVariant(ColorToken.LightGray7, OpacityToken.Opacity66),
@@ -173,7 +173,7 @@ export const AccountInfoConnectedState = () => {
<WithTooltip tooltip={tooltip} stringParams={stringParams}>
<Styled.WithUsage>
{label}
{hasError ? <Styled.CautionIcon iconName={IconName.CautionCircle} /> : slotRight}
{hasError ? <Styled.Icon iconName={IconName.CautionCircle} /> : slotRight}
</Styled.WithUsage>
</WithTooltip>
),
@@ -230,7 +230,7 @@ Styled.CircleContainer = styled.div`
border-radius: 50%;
`;
Styled.CautionIcon = styled(Icon)`
Styled.Icon = styled(Icon)`
color: var(--color-error);
`;
+3 -3
View File
@@ -557,11 +557,11 @@ Styled.PositionTile = styled(PositionTile)``;
Styled.ClosePositionButton = styled(Button)`
--button-border: solid var(--border-width) var(--color-border-red);
--button-textColor: var(--color-red);
--button-textColor: var(--color-error);
`;
Styled.ClosePositionToggleButton = styled(ToggleButton)`
--button-border: solid var(--border-width) var(--color-border-red);
--button-toggle-off-textColor: var(--color-red);
--button-toggle-on-textColor: var(--color-red);
--button-toggle-off-textColor: var(--color-error);
--button-toggle-on-textColor: var(--color-error);
`;
+3 -2
View File
@@ -39,6 +39,7 @@ export const DisplaySettingsDialog = ({ setIsOpen }: ElementProps) => {
const sectionHeader = (heading: string) => {
return (
<Styled.Header>
{heading}
{heading}
<HorizontalSeparatorFiller />
</Styled.Header>
@@ -286,10 +287,10 @@ Styled.ArrowIcon = styled(Icon)<{ direction: 'up' | 'down'; color: 'green' | 're
${({ color }) =>
({
['green']: css`
color: var(--color-green);
color: var(--color-success);
`,
['red']: css`
color: var(--color-red);
color: var(--color-error);
`,
}[color])}
`;
+2 -1
View File
@@ -155,7 +155,8 @@ Styled.CautionIconContainer = styled.div`
content: '';
width: 2.5rem;
height: 2.5rem;
background-color: var(--color-gradient-error);
background-color: var(--color-error);
opacity: 0.1;
}
`;
@@ -323,7 +323,7 @@ Styled.ReceiptArea = styled.div`
`;
Styled.Green = styled.span`
color: var(--color-green);
color: var(--color-success);
`;
Styled.GreenCheckCircle = styled(GreenCheckCircle)`
+4 -4
View File
@@ -306,7 +306,7 @@ export const TransferForm = ({
label={
<Styled.DestinationInputLabel>
{stringGetter({ key: STRING_KEYS.DESTINATION })}
{isAddressValid && <Styled.CheckIcon iconName={IconName.Check} />}
{isAddressValid && <Icon iconName={IconName.Check} />}
</Styled.DestinationInputLabel>
}
type={InputType.Text}
@@ -439,10 +439,10 @@ Styled.InlineRow = styled.span`
Styled.DestinationInputLabel = styled.span`
${layoutMixins.inlineRow}
`;
Styled.CheckIcon = styled(Icon)`
color: var(--color-success);
svg {
color: var(--color-success);
}
`;
Styled.AddressValidationAlertMessage = styled(AlertMessage)`
@@ -82,6 +82,6 @@ Styled.ActionButton = styled(IconButton)`
Styled.CancelButton = styled(Styled.ActionButton)`
&:not(:disabled) {
--button-textColor: var(--color-red);
--button-textColor: var(--color-error);
}
`;