Skip to content

Commit

Permalink
Merge pull request #337 from djeck1432/fix/slidebar
Browse files Browse the repository at this point in the history
fix/slider
  • Loading branch information
djeck1432 authored Dec 10, 2024
2 parents bc869e6 + 55013c5 commit 6557f85
Show file tree
Hide file tree
Showing 6 changed files with 162 additions and 154 deletions.
7 changes: 6 additions & 1 deletion frontend/src/components/TableOfContent/TableOfContents.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,15 @@ const TableOfContents = ({ items, defaultActiveId, tabelTitle, headerHeight = 80

window.scrollTo({
top: targetId === defaultActiveId ? 0 : offsetPosition,
// top: offsetPosition,

behavior: 'smooth',
});

setActiveId(targetId);
// setActiveId(targetId);
setTimeout(() => {
setActiveId(targetId);
}, 250);
}
};

Expand Down
293 changes: 145 additions & 148 deletions frontend/src/components/multiplier.css
Original file line number Diff line number Diff line change
@@ -1,209 +1,206 @@
.slider-container {
width: 100%;
border: none;
padding-top: 48px;
width: 100%;
border: none;
padding-top: 48px;
}

.slider {
position: relative;
height: 8px;
width: 100%;
cursor: pointer;
position: relative;
height: 8px;
width: 100%;
cursor: pointer;
}

.slider-track {
position: absolute;
height: 100%;
width: 100%;
border-radius: 9999px;
overflow: hidden;
border: 1px solid var(--footer-divider-bg);
position: absolute;
height: 100%;
width: 100%;
border-radius: 9999px;
overflow: hidden;
border: 1px solid var(--footer-divider-bg);
}

.slider-track-wrapper {
position: absolute;
height: 100%;
width: 100%;
border-radius: 9999px;
overflow: hidden;
padding: 1px;
position: absolute;
height: 100%;
width: 100%;
border-radius: 9999px;
overflow: hidden;
padding: 1px;
}

.slider-range {
position: absolute;
height: 100%;
background: linear-gradient(to right, #49ABD2, #E01DEE);
position: absolute;
height: 100%;
background: linear-gradient(to right, #49abd2, #e01dee);
}

.slider-thumb {
position: absolute;
top: 50%;
transform: translate(-50%, -50%);
transition: background-color 0.3s;
position: absolute;
top: 50%;
transform: translate(-50%, -50%);
transition: background-color 0.3s;
}

.tooltip {
position: absolute;
height: 35.6px;
width: 46px;
bottom: 42px;
left: 50%;
transform: translateX(-50%);
background-color: #2C5475;
color: #ffffff;
font-size: 14px;
padding: 6px 8px;
border-radius: 7.17px;
opacity: 0.9;
transition: opacity 0.2s ease-in-out;
text-align: center;
position: absolute;
height: 35.6px;
width: 46px;
bottom: 42px;
left: 50%;
transform: translateX(-50%);
background-color: #2c5475;
color: #ffffff;
font-size: 14px;
padding: 6px 8px;
border-radius: 7.17px;
opacity: 0.9;
transition: opacity 0.2s ease-in-out;
text-align: center;
}

.tooltip:after {
content: "";
position: absolute;
bottom: -13px;
left: 50%;
transform: translateX(-50%);
border-width: 7px;
border-style: solid;
border-color: #2C5475 transparent transparent transparent;
content: '';
position: absolute;
bottom: -13px;
left: 50%;
transform: translateX(-50%);
border-width: 7px;
border-style: solid;
border-color: #2c5475 transparent transparent transparent;
}

.multiplier-slider-container {
margin: 15px 1px -10px 8px;
width: 97%;
margin: 15px 1px -10px 8px;
width: 97%;
}

.slider-with-tooltip {
position: relative;
width: 100%;
position: relative;
width: 100%;
}

.error-message {
color: var(--borrow-color);
background-color: #ffe6e6;
padding: 10px;
border-radius: 4px;
margin: 10px 0;
text-align: center;
font-weight: bold;
color: var(--borrow-color);
background-color: #ffe6e6;
padding: 10px;
border-radius: 4px;
margin: 10px 0;
text-align: center;
font-weight: bold;
}

div.slider-skeleton {
width: 100%;
padding: 10px 20px;
background: linear-gradient(90deg, var(--primary) 25%, var(--secondary) 50%, var(--primary) 75%);
background-size: 200% 100%;
animation: loading 1.5s infinite;
border-radius: 2px;
margin: 20px 0;
color: var(--primary-color);
width: 100%;
padding: 10px 20px;
background: linear-gradient(90deg, var(--primary) 25%, var(--secondary) 50%, var(--primary) 75%);
background-size: 200% 100%;
animation: loading 1.5s infinite;
border-radius: 2px;
margin: 20px 0;
color: var(--primary-color);
}

.mark-container {
width: 100%;
display: flex;
justify-content: space-between;
margin-top: 20px;
width: 100%;
display: flex;
justify-content: space-between;
margin-top: 20px;
}

.mark-item {
display: flex;
flex-direction: column;
gap: 8px;
align-items: center;
width: 18px;
display: flex;
flex-direction: column;
gap: 8px;
align-items: center;
width: 18px;
}

div.marker {
background: var(--slider-gray);
width: 4px;
height: 12px;
border-radius: 12px;
background: var(--slider-gray);
width: 4px;
height: 12px;
border-radius: 12px;
}

.mark-item.active div.marker {
background: var(--light-blue);
width: 4px;
height: 12px;
border-radius: 12px;
background: var(--light-blue);
width: 4px;
height: 12px;
border-radius: 12px;
}

.mark-label {
color: var(--slider-gray);
font-size: 0.875rem;
color: var(--slider-gray);
font-size: 0.875rem;
}

.mark-item.active .mark-label {
color: var(--primary);
font-size: 0.875rem;
color: var(--primary);
font-size: 0.875rem;
}


@keyframes loading {
0% {
background-position: 200% 0;
}
0% {
background-position: 200% 0;
}

100% {
background-position: -200% 0;
}
100% {
background-position: -200% 0;
}
}



/* Responsiveness */
/* Mobile */
@media (max-width: 768px) {
.multiplier-slider-container {
margin: 10px 0px -10px 0;
width: 100%;
padding: 0px 9px;
}

.slider-container {
height: 112px;
border: none;
max-height: 85px;
width: 100%;
padding-top: 32px;
}

.slider {
height: 8px;
}

.cursor {
height: 24px;
width: 23.49px;
}

.tooltip {
font-size: 12px;
padding: 3px;
height: 25.41px;
width: 36px;
bottom: 32px;
}

.tooltip:after {
border-width: 6px;
bottom: -11px;
}

.mark-item {
gap: 4px;
}

div.marker,
.mark-item.active div.marker {
width: 2px;
height: 8px;
}

.mark-item.active .mark-label,
.mark-label {
font-size: 10px;
}
}
.multiplier-slider-container {
margin: 10px 0px -10px 0;
width: 100%;
padding: 0px 9px;
}

.slider-container {
height: 112px;
border: none;
max-height: 85px;
width: 100%;
padding-top: 32px;
}

.slider {
height: 8px;
}

.cursor {
height: 24px;
width: 23.49px;
}

.tooltip {
font-size: 12px;
padding: 3px;
height: 25.41px;
width: 36px;
bottom: 32px;
}

.tooltip:after {
border-width: 6px;
bottom: -11px;
}

.mark-item {
gap: 4px;
}

div.marker,
.mark-item.active div.marker {
width: 2px;
height: 8px;
}

.mark-item.active .mark-label,
.mark-label {
font-size: 10px;
}
}
3 changes: 1 addition & 2 deletions frontend/src/hooks/useMaxMultiplier.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ export const useMaxMultiplier = () => {
const response = await axios.get(`${backendUrl}/api/get-multipliers`);
return response.data.multipliers;
},
staleTime: ONE_HOUR_IN_MILLISECONDS,
staleTime: ONE_HOUR_IN_MILLISECONDS,
refetchInterval: ONE_HOUR_IN_MILLISECONDS,
});

return { data, isLoading: isPending, error };
};

4 changes: 3 additions & 1 deletion frontend/src/pages/forms/Form.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ const Form = () => {
const { data: positionData, refetch: refetchPosition } = useCheckPosition();

const connectWalletHandler = () => {
connectWalletMutation.mutate();
if (!walletId) {
connectWalletMutation.mutate();
}
};

const [balances, setBalances] = useState([
Expand Down
Loading

0 comments on commit 6557f85

Please sign in to comment.