rujira.ui 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/esm/wallets/providers/ton.js +1 -1
- package/package.json +8 -8
- package/src/wallets/providers/ton.ts +1 -1
- package/lib/cjs/assets/tokens/index.js +0 -21
- package/lib/cjs/components/AssetLabel.js +0 -9
- package/lib/cjs/components/balance/OmniBalance.js +0 -28
- package/lib/cjs/components/bridges/BuyModal.js +0 -8
- package/lib/cjs/components/bridges/DepositModal.js +0 -131
- package/lib/cjs/components/buttons/Button.js +0 -52
- package/lib/cjs/components/buttons/Popout.js +0 -63
- package/lib/cjs/components/buttons/TxButton.js +0 -171
- package/lib/cjs/components/buttons/__Popout.js +0 -39
- package/lib/cjs/components/cards/Card.js +0 -12
- package/lib/cjs/components/cards/GradientCard.js +0 -12
- package/lib/cjs/components/cards/ShareCard.js +0 -16
- package/lib/cjs/components/chart/RangeLiquidityChart.js +0 -118
- package/lib/cjs/components/footer/Footer.js +0 -15
- package/lib/cjs/components/header/Accounts.js +0 -129
- package/lib/cjs/components/header/Header.js +0 -197
- package/lib/cjs/components/header/Pending.js +0 -47
- package/lib/cjs/components/header/QuickLauncher.js +0 -15
- package/lib/cjs/components/header/ResolveLink.js +0 -17
- package/lib/cjs/components/icons/IconDenom.js +0 -391
- package/lib/cjs/components/icons/Icons.js +0 -350
- package/lib/cjs/components/icons/NetworkIcon.js +0 -44
- package/lib/cjs/components/icons/Networks.js +0 -145
- package/lib/cjs/components/icons/Wallets.js +0 -140
- package/lib/cjs/components/inputs/Checkbox.js +0 -15
- package/lib/cjs/components/inputs/DecimalInput.js +0 -53
- package/lib/cjs/components/inputs/DenomInput.js +0 -29
- package/lib/cjs/components/inputs/Input.js +0 -29
- package/lib/cjs/components/inputs/Numeric.js +0 -24
- package/lib/cjs/components/inputs/Radio.js +0 -15
- package/lib/cjs/components/inputs/Select.js +0 -32
- package/lib/cjs/components/inputs/SwapSelect.js +0 -85
- package/lib/cjs/components/inputs/Textarea.js +0 -28
- package/lib/cjs/components/inputs/Toggle.js +0 -17
- package/lib/cjs/components/loader/Loader.js +0 -9
- package/lib/cjs/components/logos/RujiraLogo.js +0 -10
- package/lib/cjs/components/notices/Warning.js +0 -14
- package/lib/cjs/components/numbers/Decimal.js +0 -30
- package/lib/cjs/components/numbers/Fiat.js +0 -22
- package/lib/cjs/components/pagination/Pagination.js +0 -15
- package/lib/cjs/components/progress/Progress.js +0 -13
- package/lib/cjs/components/slider/Slider.js +0 -9
- package/lib/cjs/components/table/SortItem.js +0 -52
- package/lib/cjs/context/GlobalModal.js +0 -48
- package/lib/cjs/helpers/index.js +0 -167
- package/lib/cjs/helpers/number.js +0 -8
- package/lib/cjs/hooks/useClickOutside.js +0 -22
- package/lib/cjs/hooks/useEventCallback.js +0 -14
- package/lib/cjs/hooks/useEventListener.js +0 -57
- package/lib/cjs/hooks/useIsTouchDevice.js +0 -20
- package/lib/cjs/hooks/useIsomorphicLayoutEffect.js +0 -18
- package/lib/cjs/hooks/useLocalStorage.js +0 -123
- package/lib/cjs/hooks/useQueryParam.js +0 -36
- package/lib/cjs/hooks/useWindowSize.js +0 -51
- package/lib/cjs/i18n/I18nProvider.js +0 -54
- package/lib/cjs/i18n/TranslationProvider.js +0 -10
- package/lib/cjs/i18n/config.js +0 -101
- package/lib/cjs/i18n/index.js +0 -16
- package/lib/cjs/i18n/locales/de/borrow.json +0 -50
- package/lib/cjs/i18n/locales/de/common.json +0 -107
- package/lib/cjs/i18n/locales/de/ecosystem.json +0 -56
- package/lib/cjs/i18n/locales/de/header.json +0 -86
- package/lib/cjs/i18n/locales/de/index.json +0 -57
- package/lib/cjs/i18n/locales/de/leagues.json +0 -20
- package/lib/cjs/i18n/locales/de/merge.json +0 -41
- package/lib/cjs/i18n/locales/de/portfolio.json +0 -97
- package/lib/cjs/i18n/locales/de/strategies.json +0 -159
- package/lib/cjs/i18n/locales/de/swap.json +0 -30
- package/lib/cjs/i18n/locales/de/trade.json +0 -188
- package/lib/cjs/i18n/locales/en/borrow.json +0 -50
- package/lib/cjs/i18n/locales/en/common.json +0 -107
- package/lib/cjs/i18n/locales/en/ecosystem.json +0 -56
- package/lib/cjs/i18n/locales/en/header.json +0 -86
- package/lib/cjs/i18n/locales/en/index.json +0 -57
- package/lib/cjs/i18n/locales/en/leagues.json +0 -20
- package/lib/cjs/i18n/locales/en/merge.json +0 -41
- package/lib/cjs/i18n/locales/en/portfolio.json +0 -97
- package/lib/cjs/i18n/locales/en/strategies.json +0 -159
- package/lib/cjs/i18n/locales/en/swap.json +0 -30
- package/lib/cjs/i18n/locales/en/trade.json +0 -188
- package/lib/cjs/i18n/useTranslation.js +0 -21
- package/lib/cjs/index.js +0 -70
- package/lib/cjs/package.json +0 -3
- package/lib/cjs/wallets/config/gaia.js +0 -51
- package/lib/cjs/wallets/config/index.js +0 -9
- package/lib/cjs/wallets/config/kujira.js +0 -62
- package/lib/cjs/wallets/config/noble.js +0 -47
- package/lib/cjs/wallets/config/osmo.js +0 -51
- package/lib/cjs/wallets/config/thor.js +0 -50
- package/lib/cjs/wallets/index.js +0 -19
- package/lib/cjs/wallets/providers/brave.js +0 -4
- package/lib/cjs/wallets/providers/coinbase.js +0 -4
- package/lib/cjs/wallets/providers/cosmos.js +0 -152
- package/lib/cjs/wallets/providers/ctrl.js +0 -125
- package/lib/cjs/wallets/providers/daodao.js +0 -12
- package/lib/cjs/wallets/providers/eip1193.js +0 -155
- package/lib/cjs/wallets/providers/eip6963.js +0 -20
- package/lib/cjs/wallets/providers/eip712.js +0 -63
- package/lib/cjs/wallets/providers/index.js +0 -62
- package/lib/cjs/wallets/providers/keplr.js +0 -82
- package/lib/cjs/wallets/providers/leap.js +0 -36
- package/lib/cjs/wallets/providers/ledger/Modal.js +0 -23
- package/lib/cjs/wallets/providers/ledger.js +0 -93
- package/lib/cjs/wallets/providers/metamask.js +0 -4
- package/lib/cjs/wallets/providers/okx.js +0 -79
- package/lib/cjs/wallets/providers/rabby.js +0 -4
- package/lib/cjs/wallets/providers/station.js +0 -6
- package/lib/cjs/wallets/providers/ton.js +0 -57
- package/lib/cjs/wallets/providers/tronlink.js +0 -58
- package/lib/cjs/wallets/providers/trust.js +0 -4
- package/lib/cjs/wallets/providers/utils.js +0 -32
- package/lib/cjs/wallets/providers/utxo.js +0 -107
- package/lib/cjs/wallets/providers/vulticonnect.js +0 -157
- package/lib/cjs/wallets/providers/vultisig.js +0 -45
- package/lib/cjs/wallets/providers/xaman.js +0 -70
- package/lib/cjs/wallets/storage.js +0 -58
- package/lib/esm/package.json +0 -3
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useEventCallback = useEventCallback;
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
const useIsomorphicLayoutEffect_1 = require("./useIsomorphicLayoutEffect");
|
|
6
|
-
function useEventCallback(fn) {
|
|
7
|
-
const ref = (0, react_1.useRef)(() => {
|
|
8
|
-
throw new Error('Cannot call an event handler while rendering.');
|
|
9
|
-
});
|
|
10
|
-
(0, useIsomorphicLayoutEffect_1.useIsomorphicLayoutEffect)(() => {
|
|
11
|
-
ref.current = fn;
|
|
12
|
-
}, [fn]);
|
|
13
|
-
return (0, react_1.useCallback)((...args) => ref.current?.(...args), [ref]);
|
|
14
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useEventListener = useEventListener;
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
const useIsomorphicLayoutEffect_1 = require("./useIsomorphicLayoutEffect");
|
|
6
|
-
/**
|
|
7
|
-
* Custom hook that attaches event listeners to DOM elements, the window, or media query lists.
|
|
8
|
-
* @template KW - The type of event for window events.
|
|
9
|
-
* @template KH - The type of event for HTML or SVG element events.
|
|
10
|
-
* @template KM - The type of event for media query list events.
|
|
11
|
-
* @template T - The type of the DOM element (default is `HTMLElement`).
|
|
12
|
-
* @param {KW | KH | KM} eventName - The name of the event to listen for.
|
|
13
|
-
* @param {(event: WindowEventMap[KW] | HTMLElementEventMap[KH] | SVGElementEventMap[KH] | MediaQueryListEventMap[KM] | Event) => void} handler - The event handler function.
|
|
14
|
-
* @param {RefObject<T>} [element] - The DOM element or media query list to attach the event listener to (optional).
|
|
15
|
-
* @param {boolean | AddEventListenerOptions} [options] - An options object that specifies characteristics about the event listener (optional).
|
|
16
|
-
* @public
|
|
17
|
-
* @see [Documentation](https://usehooks-ts.com/react-hook/use-event-listener)
|
|
18
|
-
* @example
|
|
19
|
-
* ```tsx
|
|
20
|
-
* // Example 1: Attach a window event listener
|
|
21
|
-
* useEventListener('resize', handleResize);
|
|
22
|
-
* ```
|
|
23
|
-
* @example
|
|
24
|
-
* ```tsx
|
|
25
|
-
* // Example 2: Attach a document event listener with options
|
|
26
|
-
* const elementRef = useRef(document);
|
|
27
|
-
* useEventListener('click', handleClick, elementRef, { capture: true });
|
|
28
|
-
* ```
|
|
29
|
-
* @example
|
|
30
|
-
* ```tsx
|
|
31
|
-
* // Example 3: Attach an element event listener
|
|
32
|
-
* const buttonRef = useRef<HTMLButtonElement>(null);
|
|
33
|
-
* useEventListener('click', handleButtonClick, buttonRef);
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
|
-
function useEventListener(eventName, handler, element, options) {
|
|
37
|
-
// Create a ref that stores handler
|
|
38
|
-
const savedHandler = (0, react_1.useRef)(handler);
|
|
39
|
-
(0, useIsomorphicLayoutEffect_1.useIsomorphicLayoutEffect)(() => {
|
|
40
|
-
savedHandler.current = handler;
|
|
41
|
-
}, [handler]);
|
|
42
|
-
(0, react_1.useEffect)(() => {
|
|
43
|
-
// Define the listening target
|
|
44
|
-
const targetElement = element?.current ?? window;
|
|
45
|
-
if (!(targetElement && targetElement.addEventListener))
|
|
46
|
-
return;
|
|
47
|
-
// Create event listener that calls handler function stored in ref
|
|
48
|
-
const listener = event => {
|
|
49
|
-
savedHandler.current(event);
|
|
50
|
-
};
|
|
51
|
-
targetElement.addEventListener(eventName, listener, options);
|
|
52
|
-
// Remove event listener on cleanup
|
|
53
|
-
return () => {
|
|
54
|
-
targetElement.removeEventListener(eventName, listener, options);
|
|
55
|
-
};
|
|
56
|
-
}, [eventName, element, options]);
|
|
57
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useIsTouchDevice = useIsTouchDevice;
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
function useIsTouchDevice() {
|
|
6
|
-
const [isTouchDevice, setIsTouchDevice] = (0, react_1.useState)(false);
|
|
7
|
-
(0, react_1.useEffect)(() => {
|
|
8
|
-
function onResize() {
|
|
9
|
-
setIsTouchDevice("ontouchstart" in window ||
|
|
10
|
-
navigator.maxTouchPoints > 0 ||
|
|
11
|
-
navigator.maxTouchPoints > 0);
|
|
12
|
-
}
|
|
13
|
-
window.addEventListener("resize", onResize);
|
|
14
|
-
onResize();
|
|
15
|
-
return () => {
|
|
16
|
-
window.removeEventListener("resize", onResize);
|
|
17
|
-
};
|
|
18
|
-
}, []);
|
|
19
|
-
return isTouchDevice;
|
|
20
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useIsomorphicLayoutEffect = void 0;
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
/**
|
|
6
|
-
* Custom hook that uses either `useLayoutEffect` or `useEffect` based on the environment (client-side or server-side).
|
|
7
|
-
* @param {Function} effect - The effect function to be executed.
|
|
8
|
-
* @param {Array<any>} [dependencies] - An array of dependencies for the effect (optional).
|
|
9
|
-
* @public
|
|
10
|
-
* @see [Documentation](https://usehooks-ts.com/react-hook/use-isomorphic-layout-effect)
|
|
11
|
-
* @example
|
|
12
|
-
* ```tsx
|
|
13
|
-
* useIsomorphicLayoutEffect(() => {
|
|
14
|
-
* // Code to be executed during the layout phase on the client side
|
|
15
|
-
* }, [dependency1, dependency2]);
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
exports.useIsomorphicLayoutEffect = typeof window !== 'undefined' ? react_1.useLayoutEffect : react_1.useEffect;
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useLocalStorage = useLocalStorage;
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
const useEventCallback_1 = require("./useEventCallback");
|
|
6
|
-
const useEventListener_1 = require("./useEventListener");
|
|
7
|
-
const IS_SERVER = typeof window === 'undefined';
|
|
8
|
-
/**
|
|
9
|
-
* Custom hook that uses the [`localStorage API`](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) to persist state across page reloads.
|
|
10
|
-
* @template T - The type of the state to be stored in local storage.
|
|
11
|
-
* @param {string} key - The key under which the value will be stored in local storage.
|
|
12
|
-
* @param {T | (() => T)} initialValue - The initial value of the state or a function that returns the initial value.
|
|
13
|
-
* @param {UseLocalStorageOptions<T>} [options] - Options for customizing the behavior of serialization and deserialization (optional).
|
|
14
|
-
* @returns {[T, Dispatch<SetStateAction<T>>, () => void]} A tuple containing the stored value, a function to set the value and a function to remove the key from storage.
|
|
15
|
-
* @public
|
|
16
|
-
* @see [Documentation](https://usehooks-ts.com/react-hook/use-local-storage)
|
|
17
|
-
* @example
|
|
18
|
-
* ```tsx
|
|
19
|
-
* const [count, setCount, removeCount] = useLocalStorage('count', 0);
|
|
20
|
-
* // Access the `count` value, the `setCount` function to update it and `removeCount` function to remove the key from storage.
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
function useLocalStorage(key, initialValue, options = {}) {
|
|
24
|
-
const { initializeWithValue = true } = options;
|
|
25
|
-
const serializer = (0, react_1.useCallback)(value => {
|
|
26
|
-
if (options.serializer) {
|
|
27
|
-
return options.serializer(value);
|
|
28
|
-
}
|
|
29
|
-
return JSON.stringify(value);
|
|
30
|
-
}, [options]);
|
|
31
|
-
const deserializer = (0, react_1.useCallback)(value => {
|
|
32
|
-
if (options.deserializer) {
|
|
33
|
-
return options.deserializer(value);
|
|
34
|
-
}
|
|
35
|
-
// Support 'undefined' as a value
|
|
36
|
-
if (value === 'undefined') {
|
|
37
|
-
return undefined;
|
|
38
|
-
}
|
|
39
|
-
const defaultValue = initialValue instanceof Function ? initialValue() : initialValue;
|
|
40
|
-
let parsed;
|
|
41
|
-
try {
|
|
42
|
-
parsed = JSON.parse(value);
|
|
43
|
-
}
|
|
44
|
-
catch (error) {
|
|
45
|
-
console.error('Error parsing JSON:', error);
|
|
46
|
-
return defaultValue; // Return initialValue if parsing fails
|
|
47
|
-
}
|
|
48
|
-
return parsed;
|
|
49
|
-
}, [options, initialValue]);
|
|
50
|
-
// Get from local storage then
|
|
51
|
-
// parse stored json or return initialValue
|
|
52
|
-
const readValue = (0, react_1.useCallback)(() => {
|
|
53
|
-
const initialValueToUse = initialValue instanceof Function ? initialValue() : initialValue;
|
|
54
|
-
// Prevent build error "window is undefined" but keep working
|
|
55
|
-
if (IS_SERVER) {
|
|
56
|
-
return initialValueToUse;
|
|
57
|
-
}
|
|
58
|
-
try {
|
|
59
|
-
const raw = window.localStorage.getItem(key);
|
|
60
|
-
return raw ? deserializer(raw) : initialValueToUse;
|
|
61
|
-
}
|
|
62
|
-
catch (error) {
|
|
63
|
-
console.warn(`Error reading localStorage key “${key}”:`, error);
|
|
64
|
-
return initialValueToUse;
|
|
65
|
-
}
|
|
66
|
-
}, [initialValue, key, deserializer]);
|
|
67
|
-
const [storedValue, setStoredValue] = (0, react_1.useState)(() => {
|
|
68
|
-
if (initializeWithValue) {
|
|
69
|
-
return readValue();
|
|
70
|
-
}
|
|
71
|
-
return initialValue instanceof Function ? initialValue() : initialValue;
|
|
72
|
-
});
|
|
73
|
-
// Return a wrapped version of useState's setter function that ...
|
|
74
|
-
// ... persists the new value to localStorage.
|
|
75
|
-
const setValue = (0, useEventCallback_1.useEventCallback)(value => {
|
|
76
|
-
// Prevent build error "window is undefined" but keeps working
|
|
77
|
-
if (IS_SERVER) {
|
|
78
|
-
console.warn(`Tried setting localStorage key “${key}” even though environment is not a client`);
|
|
79
|
-
}
|
|
80
|
-
try {
|
|
81
|
-
// Allow value to be a function so we have the same API as useState
|
|
82
|
-
const newValue = value instanceof Function ? value(readValue()) : value;
|
|
83
|
-
// Save to local storage
|
|
84
|
-
window.localStorage.setItem(key, serializer(newValue));
|
|
85
|
-
// Save state
|
|
86
|
-
setStoredValue(newValue);
|
|
87
|
-
// We dispatch a custom event so every similar useLocalStorage hook is notified
|
|
88
|
-
window.dispatchEvent(new StorageEvent('local-storage', { key }));
|
|
89
|
-
}
|
|
90
|
-
catch (error) {
|
|
91
|
-
console.warn(`Error setting localStorage key “${key}”:`, error);
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
const removeValue = (0, useEventCallback_1.useEventCallback)(() => {
|
|
95
|
-
// Prevent build error "window is undefined" but keeps working
|
|
96
|
-
if (IS_SERVER) {
|
|
97
|
-
console.warn(`Tried removing localStorage key “${key}” even though environment is not a client`);
|
|
98
|
-
}
|
|
99
|
-
const defaultValue = initialValue instanceof Function ? initialValue() : initialValue;
|
|
100
|
-
// Remove the key from local storage
|
|
101
|
-
window.localStorage.removeItem(key);
|
|
102
|
-
// Save state with default value
|
|
103
|
-
setStoredValue(defaultValue);
|
|
104
|
-
// We dispatch a custom event so every similar useLocalStorage hook is notified
|
|
105
|
-
window.dispatchEvent(new StorageEvent('local-storage', { key }));
|
|
106
|
-
});
|
|
107
|
-
(0, react_1.useEffect)(() => {
|
|
108
|
-
setStoredValue(readValue());
|
|
109
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
110
|
-
}, [key]);
|
|
111
|
-
const handleStorageChange = (0, react_1.useCallback)((event) => {
|
|
112
|
-
if (event.key && event.key !== key) {
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
setStoredValue(readValue());
|
|
116
|
-
}, [key, readValue]);
|
|
117
|
-
// this only works for other documents, not the current one
|
|
118
|
-
(0, useEventListener_1.useEventListener)('storage', handleStorageChange);
|
|
119
|
-
// this is a custom event, triggered in writeValueToLocalStorage
|
|
120
|
-
// See: useLocalStorage()
|
|
121
|
-
(0, useEventListener_1.useEventListener)('local-storage', handleStorageChange);
|
|
122
|
-
return [storedValue, setValue, removeValue];
|
|
123
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useQueryParams = exports.useQueryParam = void 0;
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
const react_router_dom_1 = require("react-router-dom");
|
|
6
|
-
const useQuery = () => {
|
|
7
|
-
const { search } = (0, react_router_dom_1.useLocation)();
|
|
8
|
-
return (0, react_1.useMemo)(() => new URLSearchParams(search), [search]);
|
|
9
|
-
};
|
|
10
|
-
const useQueryParam = (key, initial) => {
|
|
11
|
-
const location = (0, react_router_dom_1.useLocation)();
|
|
12
|
-
const navigate = (0, react_router_dom_1.useNavigate)();
|
|
13
|
-
const q = useQuery();
|
|
14
|
-
const val = q.get(key) || initial;
|
|
15
|
-
const setVal = (s) => {
|
|
16
|
-
s ? q.set(key, s) : q.delete(key);
|
|
17
|
-
navigate(`${location.pathname}?${q.toString()}`);
|
|
18
|
-
};
|
|
19
|
-
return [val, setVal];
|
|
20
|
-
};
|
|
21
|
-
exports.useQueryParam = useQueryParam;
|
|
22
|
-
const useQueryParams = (vals) => {
|
|
23
|
-
const location = (0, react_router_dom_1.useLocation)();
|
|
24
|
-
const navigate = (0, react_router_dom_1.useNavigate)();
|
|
25
|
-
const q = useQuery();
|
|
26
|
-
const val = Object.entries(vals).reduce((a, [k, v]) => ({ ...a, [k]: q.get(k) || v }), {});
|
|
27
|
-
const setVal = (s) => {
|
|
28
|
-
const r = Object.entries(s).reduce((a, [k, v]) => {
|
|
29
|
-
v ? a.set(k, v) : a.delete(k);
|
|
30
|
-
return a;
|
|
31
|
-
}, q);
|
|
32
|
-
navigate(`${location.pathname}?${r.toString()}`);
|
|
33
|
-
};
|
|
34
|
-
return [val, setVal];
|
|
35
|
-
};
|
|
36
|
-
exports.useQueryParams = useQueryParams;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useWindowDimensions = exports.BreakPoints = void 0;
|
|
4
|
-
exports.useWindowSize = useWindowSize;
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
exports.BreakPoints = {
|
|
7
|
-
xsmall: 420,
|
|
8
|
-
small: 576,
|
|
9
|
-
medium: 768,
|
|
10
|
-
large: 1024,
|
|
11
|
-
xl: 1440,
|
|
12
|
-
xxl: 1680,
|
|
13
|
-
hd: 1920,
|
|
14
|
-
ultra: 2560,
|
|
15
|
-
};
|
|
16
|
-
function useWindowSize() {
|
|
17
|
-
const [windowSize, setWindowSize] = (0, react_1.useState)({
|
|
18
|
-
width: window.outerWidth,
|
|
19
|
-
height: window.outerHeight,
|
|
20
|
-
});
|
|
21
|
-
(0, react_1.useEffect)(() => {
|
|
22
|
-
function handleResize() {
|
|
23
|
-
setWindowSize({
|
|
24
|
-
width: window.innerWidth,
|
|
25
|
-
height: window.innerHeight,
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
window.addEventListener("resize", handleResize);
|
|
29
|
-
handleResize();
|
|
30
|
-
return () => window.removeEventListener("resize", handleResize);
|
|
31
|
-
}, []);
|
|
32
|
-
return windowSize;
|
|
33
|
-
}
|
|
34
|
-
const useWindowDimensions = (innerWidth) => {
|
|
35
|
-
const [isMobileSize, setIsMobileSize] = (0, react_1.useState)(window.innerWidth <= innerWidth);
|
|
36
|
-
(0, react_1.useEffect)(() => {
|
|
37
|
-
const windowResizeHandler = () => {
|
|
38
|
-
const matchMediaString = `(max-width: ${innerWidth}px)`;
|
|
39
|
-
if (matchMedia(matchMediaString).matches) {
|
|
40
|
-
setIsMobileSize(true);
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
setIsMobileSize(false);
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
window.addEventListener('resize', windowResizeHandler);
|
|
47
|
-
return () => window.removeEventListener('resize', windowResizeHandler);
|
|
48
|
-
}, []);
|
|
49
|
-
return isMobileSize;
|
|
50
|
-
};
|
|
51
|
-
exports.useWindowDimensions = useWindowDimensions;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.I18nProvider = exports.useLocale = exports.LocaleContext = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
const react_i18next_1 = require("react-i18next");
|
|
7
|
-
const react_router_dom_1 = require("react-router-dom");
|
|
8
|
-
const config_1 = require("./config");
|
|
9
|
-
exports.LocaleContext = (0, react_1.createContext)(null);
|
|
10
|
-
const LOCALE_PREFIX_RE = new RegExp(`^/(?:${config_1.SUPPORTED_LANGUAGES.join("|")})(?=/|$)`);
|
|
11
|
-
const useLocale = () => {
|
|
12
|
-
const context = (0, react_1.useContext)(exports.LocaleContext);
|
|
13
|
-
if (!context)
|
|
14
|
-
throw new Error("useLocale must be used within I18nProvider");
|
|
15
|
-
return context;
|
|
16
|
-
};
|
|
17
|
-
exports.useLocale = useLocale;
|
|
18
|
-
const toRootPath = (localePrefix, path) => {
|
|
19
|
-
if (!path)
|
|
20
|
-
return localePrefix || "/";
|
|
21
|
-
// Absolute URI scheme (e.g. https:, mailto:) — return as-is
|
|
22
|
-
if (/^[a-z][a-z\d+.-]*:/i.test(path))
|
|
23
|
-
return path;
|
|
24
|
-
const normalized = path.startsWith("/") ? path : `/${path}`;
|
|
25
|
-
const sanitized = normalized.replace(/\/\/+/g, "/");
|
|
26
|
-
if (sanitized === "/")
|
|
27
|
-
return localePrefix || "/";
|
|
28
|
-
if (localePrefix && LOCALE_PREFIX_RE.test(sanitized)) {
|
|
29
|
-
const withoutLocale = sanitized.replace(LOCALE_PREFIX_RE, "");
|
|
30
|
-
const relative = withoutLocale.startsWith("/") ? withoutLocale.substring(1) : withoutLocale;
|
|
31
|
-
return relative ? `${localePrefix}/${relative}` : localePrefix;
|
|
32
|
-
}
|
|
33
|
-
if (localePrefix &&
|
|
34
|
-
(sanitized === localePrefix || sanitized.startsWith(`${localePrefix}/`)))
|
|
35
|
-
return sanitized;
|
|
36
|
-
return `${localePrefix || ""}${sanitized}`;
|
|
37
|
-
};
|
|
38
|
-
const I18nProvider = ({ children }) => {
|
|
39
|
-
const withoutLocale = (0, react_1.useMemo)(() => {
|
|
40
|
-
const toRoot = (path) => toRootPath("", path);
|
|
41
|
-
return { locale: undefined, localePrefix: "", toRoot };
|
|
42
|
-
}, []);
|
|
43
|
-
return ((0, jsx_runtime_1.jsxs)(react_router_dom_1.Routes, { children: [config_1.SUPPORTED_LANGUAGES.map((code) => ((0, jsx_runtime_1.jsx)(react_router_dom_1.Route, { path: `${code}/*`, element: (0, jsx_runtime_1.jsx)(Lang, { code: code, children: children }) }, code))), (0, jsx_runtime_1.jsx)(react_router_dom_1.Route, { path: "*", element: (0, jsx_runtime_1.jsx)(exports.LocaleContext.Provider, { value: withoutLocale, children: (0, jsx_runtime_1.jsx)(react_i18next_1.I18nextProvider, { i18n: config_1.i18n, children: children }) }) })] }));
|
|
44
|
-
};
|
|
45
|
-
exports.I18nProvider = I18nProvider;
|
|
46
|
-
const Lang = ({ code, children, }) => {
|
|
47
|
-
const localePrefix = `/${code}`;
|
|
48
|
-
const locale = code;
|
|
49
|
-
const value = (0, react_1.useMemo)(() => ({ locale, localePrefix, toRoot: (path) => toRootPath(localePrefix, path) }), [locale, localePrefix]);
|
|
50
|
-
(0, react_1.useLayoutEffect)(() => {
|
|
51
|
-
config_1.i18n.changeLanguage(code);
|
|
52
|
-
}, [code]);
|
|
53
|
-
return ((0, jsx_runtime_1.jsx)(exports.LocaleContext.Provider, { value: value, children: (0, jsx_runtime_1.jsx)(react_i18next_1.I18nextProvider, { i18n: config_1.i18n, children: children }) }));
|
|
54
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TranslationProvider = exports.TranslationContext = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
exports.TranslationContext = (0, react_1.createContext)(undefined);
|
|
7
|
-
const TranslationProvider = ({ namespace, children, }) => {
|
|
8
|
-
return ((0, jsx_runtime_1.jsx)(exports.TranslationContext.Provider, { value: namespace, children: children }));
|
|
9
|
-
};
|
|
10
|
-
exports.TranslationProvider = TranslationProvider;
|
package/lib/cjs/i18n/config.js
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SUPPORTED_LANGUAGES = exports.i18n = exports.getLanguage = exports.setLanguage = exports.SUPPORTED_LANGUAGE_PATTERN = void 0;
|
|
4
|
-
const i18next_1 = require("i18next");
|
|
5
|
-
exports.i18n = i18next_1.default;
|
|
6
|
-
const react_i18next_1 = require("react-i18next");
|
|
7
|
-
const borrow_json_1 = require("./locales/de/borrow.json");
|
|
8
|
-
const common_json_1 = require("./locales/de/common.json");
|
|
9
|
-
const ecosystem_json_1 = require("./locales/de/ecosystem.json");
|
|
10
|
-
const header_json_1 = require("./locales/de/header.json");
|
|
11
|
-
const index_json_1 = require("./locales/de/index.json");
|
|
12
|
-
const leagues_json_1 = require("./locales/de/leagues.json");
|
|
13
|
-
const merge_json_1 = require("./locales/de/merge.json");
|
|
14
|
-
const portfolio_json_1 = require("./locales/de/portfolio.json");
|
|
15
|
-
const strategies_json_1 = require("./locales/de/strategies.json");
|
|
16
|
-
const swap_json_1 = require("./locales/de/swap.json");
|
|
17
|
-
const trade_json_1 = require("./locales/de/trade.json");
|
|
18
|
-
const borrow_json_2 = require("./locales/en/borrow.json");
|
|
19
|
-
const common_json_2 = require("./locales/en/common.json");
|
|
20
|
-
const ecosystem_json_2 = require("./locales/en/ecosystem.json");
|
|
21
|
-
const header_json_2 = require("./locales/en/header.json");
|
|
22
|
-
const index_json_2 = require("./locales/en/index.json");
|
|
23
|
-
const leagues_json_2 = require("./locales/en/leagues.json");
|
|
24
|
-
const merge_json_2 = require("./locales/en/merge.json");
|
|
25
|
-
const portfolio_json_2 = require("./locales/en/portfolio.json");
|
|
26
|
-
const strategies_json_2 = require("./locales/en/strategies.json");
|
|
27
|
-
const swap_json_2 = require("./locales/en/swap.json");
|
|
28
|
-
const trade_json_2 = require("./locales/en/trade.json");
|
|
29
|
-
const STORAGE_KEY = "language";
|
|
30
|
-
const SUPPORTED_LANGUAGES = ["en", "de"];
|
|
31
|
-
exports.SUPPORTED_LANGUAGES = SUPPORTED_LANGUAGES;
|
|
32
|
-
exports.SUPPORTED_LANGUAGE_PATTERN = SUPPORTED_LANGUAGES.join("|");
|
|
33
|
-
const detectLanguage = () => {
|
|
34
|
-
const stored = localStorage.getItem(STORAGE_KEY);
|
|
35
|
-
if (stored && SUPPORTED_LANGUAGES.includes(stored)) {
|
|
36
|
-
return stored;
|
|
37
|
-
}
|
|
38
|
-
const browserLang = navigator.language?.split("-")[0] || "en";
|
|
39
|
-
if (SUPPORTED_LANGUAGES.includes(browserLang)) {
|
|
40
|
-
return browserLang;
|
|
41
|
-
}
|
|
42
|
-
return "en";
|
|
43
|
-
};
|
|
44
|
-
const setLanguage = (lang) => {
|
|
45
|
-
localStorage.setItem(STORAGE_KEY, lang);
|
|
46
|
-
i18next_1.default.changeLanguage(lang);
|
|
47
|
-
};
|
|
48
|
-
exports.setLanguage = setLanguage;
|
|
49
|
-
const getLanguage = () => {
|
|
50
|
-
return i18next_1.default.language;
|
|
51
|
-
};
|
|
52
|
-
exports.getLanguage = getLanguage;
|
|
53
|
-
i18next_1.default.use(react_i18next_1.initReactI18next).init({
|
|
54
|
-
resources: {
|
|
55
|
-
en: {
|
|
56
|
-
swap: swap_json_2.default,
|
|
57
|
-
trade: trade_json_2.default,
|
|
58
|
-
common: common_json_2.default,
|
|
59
|
-
strategies: strategies_json_2.default,
|
|
60
|
-
portfolio: portfolio_json_2.default,
|
|
61
|
-
index: index_json_2.default,
|
|
62
|
-
borrow: borrow_json_2.default,
|
|
63
|
-
header: header_json_2.default,
|
|
64
|
-
ecosystem: ecosystem_json_2.default,
|
|
65
|
-
merge: merge_json_2.default,
|
|
66
|
-
leagues: leagues_json_2.default,
|
|
67
|
-
},
|
|
68
|
-
de: {
|
|
69
|
-
swap: swap_json_1.default,
|
|
70
|
-
trade: trade_json_1.default,
|
|
71
|
-
common: common_json_1.default,
|
|
72
|
-
strategies: strategies_json_1.default,
|
|
73
|
-
portfolio: portfolio_json_1.default,
|
|
74
|
-
index: index_json_1.default,
|
|
75
|
-
borrow: borrow_json_1.default,
|
|
76
|
-
header: header_json_1.default,
|
|
77
|
-
ecosystem: ecosystem_json_1.default,
|
|
78
|
-
merge: merge_json_1.default,
|
|
79
|
-
leagues: leagues_json_1.default,
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
lng: detectLanguage(),
|
|
83
|
-
fallbackLng: "en",
|
|
84
|
-
defaultNS: "swap",
|
|
85
|
-
ns: [
|
|
86
|
-
"swap",
|
|
87
|
-
"trade",
|
|
88
|
-
"common",
|
|
89
|
-
"strategies",
|
|
90
|
-
"portfolio",
|
|
91
|
-
"index",
|
|
92
|
-
"borrow",
|
|
93
|
-
"header",
|
|
94
|
-
"ecosystem",
|
|
95
|
-
"merge",
|
|
96
|
-
"leagues",
|
|
97
|
-
],
|
|
98
|
-
interpolation: {
|
|
99
|
-
escapeValue: false,
|
|
100
|
-
},
|
|
101
|
-
});
|
package/lib/cjs/i18n/index.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SUPPORTED_LANGUAGE_PATTERN = exports.SUPPORTED_LANGUAGES = exports.getLanguage = exports.setLanguage = exports.useTranslation = exports.TranslationProvider = exports.useLocale = exports.I18nProvider = void 0;
|
|
4
|
-
// i18n system
|
|
5
|
-
var I18nProvider_1 = require("./I18nProvider");
|
|
6
|
-
Object.defineProperty(exports, "I18nProvider", { enumerable: true, get: function () { return I18nProvider_1.I18nProvider; } });
|
|
7
|
-
Object.defineProperty(exports, "useLocale", { enumerable: true, get: function () { return I18nProvider_1.useLocale; } });
|
|
8
|
-
var TranslationProvider_1 = require("./TranslationProvider");
|
|
9
|
-
Object.defineProperty(exports, "TranslationProvider", { enumerable: true, get: function () { return TranslationProvider_1.TranslationProvider; } });
|
|
10
|
-
var useTranslation_1 = require("./useTranslation");
|
|
11
|
-
Object.defineProperty(exports, "useTranslation", { enumerable: true, get: function () { return useTranslation_1.useTranslation; } });
|
|
12
|
-
var config_1 = require("./config");
|
|
13
|
-
Object.defineProperty(exports, "setLanguage", { enumerable: true, get: function () { return config_1.setLanguage; } });
|
|
14
|
-
Object.defineProperty(exports, "getLanguage", { enumerable: true, get: function () { return config_1.getLanguage; } });
|
|
15
|
-
Object.defineProperty(exports, "SUPPORTED_LANGUAGES", { enumerable: true, get: function () { return config_1.SUPPORTED_LANGUAGES; } });
|
|
16
|
-
Object.defineProperty(exports, "SUPPORTED_LANGUAGE_PATTERN", { enumerable: true, get: function () { return config_1.SUPPORTED_LANGUAGE_PATTERN; } });
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"pageTitle": "Leihen | Rujira Finance",
|
|
3
|
-
"pageDescription": "Liquidität freisetzen durch Kreditaufnahme gegen deine Vermögenswerte. Flexible Konditionen, wettbewerbsfähige Zinsen.",
|
|
4
|
-
"borrowTitle": "Leihen",
|
|
5
|
-
"borrowSubheading": "Zugang zu Liquidität für Marktengagement oder zur Finanzierung deiner Ausgaben, ohne deine Bestände zu verkaufen.",
|
|
6
|
-
"arrivingImminently": "In Kürze verfügbar...",
|
|
7
|
-
"deposit": "Einzahlen",
|
|
8
|
-
"price": "Preis",
|
|
9
|
-
"collateralRatio": "Sicherheitenquote",
|
|
10
|
-
"adjustedCollateralValue": "Angepasster Sicherheitenwert",
|
|
11
|
-
"available": "Verfügbar",
|
|
12
|
-
"annualInterestRate": "Jährlicher Zinssatz",
|
|
13
|
-
"adjustedLtv": "Angepasster LTV",
|
|
14
|
-
"liquidationPrice": "Liquidationspreis",
|
|
15
|
-
"borrow": "Leihen",
|
|
16
|
-
"myPositions": "Meine Positionen",
|
|
17
|
-
"collateral": "Sicherheiten",
|
|
18
|
-
"debt": "Schulden",
|
|
19
|
-
"interestRate": "Zinssatz",
|
|
20
|
-
"ltv": "LTV",
|
|
21
|
-
"manage": "Verwalten",
|
|
22
|
-
"noPositionsFound": "Keine Positionen gefunden.",
|
|
23
|
-
"positionClosed": "Position geschlossen",
|
|
24
|
-
"invalidDebtRemaining": "Ungültig. Restschuld vorhanden.",
|
|
25
|
-
"newLtv": "Neuer LTV",
|
|
26
|
-
"newLiquidationPrice": "Neuer Liquidationspreis",
|
|
27
|
-
"managePosition": "Position verwalten",
|
|
28
|
-
"deposited": "Eingezahlt",
|
|
29
|
-
"borrowed": "Geliehen",
|
|
30
|
-
"repayLoanTab": "Kredit zurückzahlen",
|
|
31
|
-
"increaseLoanTab": "Kredit erhöhen",
|
|
32
|
-
"swapCollateralTab": "Sicherheiten tauschen",
|
|
33
|
-
"repayLoan": "Kredit zurückzahlen",
|
|
34
|
-
"withdrawCollateral": "Sicherheiten abheben",
|
|
35
|
-
"depositCollateral": "Sicherheiten einzahlen",
|
|
36
|
-
"increaseLoan": "Kredit erhöhen",
|
|
37
|
-
"from": "Von",
|
|
38
|
-
"to": "Nach",
|
|
39
|
-
"swapCollateral": "Sicherheiten tauschen",
|
|
40
|
-
"noSwapRouteFound": "Keine Tauschoption gefunden",
|
|
41
|
-
"slippageTolerance": "Slippage-Toleranz",
|
|
42
|
-
"acceptTerms": "Ich akzeptiere die",
|
|
43
|
-
"termsOfUse": "Nutzungsbedingungen",
|
|
44
|
-
"collateralRatioTooltip": "Multiplikator, der auf den Oracle-Preis des Assets angewendet wird, um seinen Wert als Sicherheit für Schuldenpositionen zu bestimmen",
|
|
45
|
-
"adjustedCollateralValueTooltip": "Der Wert der {{symbol}}-Sicherheiten bei der Berechnung des Kredit-LTV",
|
|
46
|
-
"interestRateTooltip": "Dynamischer jährlicher Zinssatz, der pro Block berechnet wird und je nach Angebot und Nachfrage variiert",
|
|
47
|
-
"ltvTooltip": "Verhältnis des Schuldenwerts zum angepassten Sicherheitenwert",
|
|
48
|
-
"liquidationPriceTooltip": "Der {{symbol}}-Preis, bei dem deine Position liquidiert werden kann",
|
|
49
|
-
"adjustedLtvTooltip": "Der angepasste LTV bestimmt dein Liquidationsrisiko. Bei 100% kann deine Position liquidiert werden."
|
|
50
|
-
}
|