Compare commits
3 Commits
v0.1.0-dev
...
v0.1.0-dev
Author | SHA1 | Date |
---|---|---|
semantic-release-bot | f85ac28f09 | |
Derrick Hammer | 4d54603ee5 | |
Derrick Hammer | 8a57d5d4af |
|
@ -1,3 +1,5 @@
|
||||||
|
# [0.1.0-develop.36](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.35...v0.1.0-develop.36) (2023-10-13)
|
||||||
|
|
||||||
# [0.1.0-develop.35](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.34...v0.1.0-develop.35) (2023-10-13)
|
# [0.1.0-develop.35](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.34...v0.1.0-develop.35) (2023-10-13)
|
||||||
|
|
||||||
# [0.1.0-develop.34](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.33...v0.1.0-develop.34) (2023-10-13)
|
# [0.1.0-develop.34](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.33...v0.1.0-develop.34) (2023-10-13)
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "@lumeweb/sdk",
|
"name": "@lumeweb/sdk",
|
||||||
"version": "0.1.0-develop.35",
|
"version": "0.1.0-develop.36",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@lumeweb/sdk",
|
"name": "@lumeweb/sdk",
|
||||||
"version": "0.1.0-develop.35",
|
"version": "0.1.0-develop.36",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@lumeweb/kernel-network-registry-client": "0.1.0-develop.10",
|
"@lumeweb/kernel-network-registry-client": "0.1.0-develop.10",
|
||||||
"@lumeweb/libkernel": "0.1.0-develop.65",
|
"@lumeweb/libkernel": "0.1.0-develop.65",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@lumeweb/sdk",
|
"name": "@lumeweb/sdk",
|
||||||
"version": "0.1.0-develop.35",
|
"version": "0.1.0-develop.36",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"types": "lib/src/index.d.ts",
|
"types": "lib/src/index.d.ts",
|
||||||
|
|
|
@ -118,16 +118,6 @@ const NetworkIndicator = ({ network }: { network: Network }) => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
function getTextDimensions(
|
|
||||||
fontSize: number,
|
|
||||||
ratios: { width: number; height: number },
|
|
||||||
) {
|
|
||||||
const width = fontSize * ratios.width;
|
|
||||||
const height = fontSize * ratios.height;
|
|
||||||
|
|
||||||
return { width, height };
|
|
||||||
}
|
|
||||||
|
|
||||||
const CircularProgress = ({
|
const CircularProgress = ({
|
||||||
chain,
|
chain,
|
||||||
className,
|
className,
|
||||||
|
@ -135,37 +125,13 @@ const CircularProgress = ({
|
||||||
chain: Network;
|
chain: Network;
|
||||||
className?: string;
|
className?: string;
|
||||||
}) => {
|
}) => {
|
||||||
const [fontRatio, setFontRatio] = useState({
|
const size = 60;
|
||||||
width: 0,
|
|
||||||
height: 0,
|
|
||||||
});
|
|
||||||
useEffect(() => {
|
|
||||||
const testText = document.createElement("span");
|
|
||||||
testText.style.fontSize = `${textSize}px`;
|
|
||||||
testText.style.position = "absolute";
|
|
||||||
testText.style.left = "-9999px"; // This effectively hides the element
|
|
||||||
testText.textContent = "The quick brown fox jumps over the lazy dog";
|
|
||||||
|
|
||||||
document.body.appendChild(testText);
|
|
||||||
|
|
||||||
const rect = testText.getBoundingClientRect();
|
|
||||||
|
|
||||||
setFontRatio({
|
|
||||||
width: rect.width / textSize,
|
|
||||||
height: rect.height / textSize,
|
|
||||||
});
|
|
||||||
|
|
||||||
// Clean up after measurements
|
|
||||||
document.body.removeChild(testText);
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const size = 55;
|
|
||||||
const progressWidth = 2;
|
const progressWidth = 2;
|
||||||
const circleWidth = 2;
|
const circleWidth = 2;
|
||||||
const radius = size / 2 - 10;
|
const radius = size / 2 - 10;
|
||||||
const circumference = 2 * radius * Math.PI;
|
const circumference = 2 * radius * Math.PI;
|
||||||
const offset = circumference * ((100 - chain.sync) / 100);
|
const offset = circumference * ((100 - chain.sync) / 100);
|
||||||
const textSize = 11;
|
const fontSize = 15;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<svg
|
<svg
|
||||||
|
@ -200,12 +166,12 @@ const CircularProgress = ({
|
||||||
fill="transparent"
|
fill="transparent"
|
||||||
strokeDasharray={`${circumference}px`}></circle>
|
strokeDasharray={`${circumference}px`}></circle>
|
||||||
<text
|
<text
|
||||||
x="4px"
|
x="21px"
|
||||||
y="25px"
|
y="32px"
|
||||||
fill="currentColor"
|
fill="currentColor"
|
||||||
fontSize="26px"
|
fontSize={`${fontSize}px`}
|
||||||
fontWeight="normal"
|
fontWeight="normal"
|
||||||
style={{ transform: "rotate(90deg) translate(0px, -32px)" }}>
|
style={{ transform: "rotate(90deg) translate(0px, -56px)" }}>
|
||||||
{chain.sync}
|
{chain.sync}
|
||||||
</text>
|
</text>
|
||||||
</svg>
|
</svg>
|
||||||
|
|
Loading…
Reference in New Issue