Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

Better loading bar

Blue Mouse039884e6fda5
diff --git a/web/app/pages/Project/View/ViewProject.tsx b/web/app/pages/Project/View/ViewProject.tsx
index 4941119d5..bcaa1c9e9 100644
--- a/web/app/pages/Project/View/ViewProject.tsx
+++ b/web/app/pages/Project/View/ViewProject.tsx
@@ -118,6 +118,7 @@ import Checkbox from '~/ui/Checkbox'
import Dropdown from '~/ui/Dropdown'
import FlatPicker from '~/ui/Flatpicker'
import Loader from '~/ui/Loader'
+import LoadingBar from '~/ui/LoadingBar'
import Select from '~/ui/Select'
import { trackCustom } from '~/utils/analytics'
import { periodToCompareDate } from '~/utils/compareConvertDate'
@@ -3654,11 +3655,8 @@ const ViewProject = () => {
resetMetrics={resetCustomMetrics}
/>
{dataLoading ? (
- <div className='static mt-4 !bg-transparent' id='loader'>
- <div className='loader-head dark:!bg-slate-800'>
- <div className='first dark:!bg-slate-600' />
- <div className='second dark:!bg-slate-600' />
- </div>
+ <div className='mt-4'>
+ <LoadingBar />
</div>
) : null}
<div className='mt-5 grid grid-cols-1 gap-5 sm:grid-cols-2 lg:grid-cols-3'>
@@ -3980,11 +3978,8 @@ const ViewProject = () => {
</div>
<Filters tnMapping={tnMapping} />
{dataLoading ? (
- <div className='static mt-4 !bg-transparent' id='loader'>
- <div className='loader-head dark:!bg-slate-800'>
- <div className='first dark:!bg-slate-600' />
- <div className='second dark:!bg-slate-600' />
- </div>
+ <div className='mt-4'>
+ <LoadingBar />
</div>
) : null}
<div className='mt-5 grid grid-cols-1 gap-5 sm:grid-cols-2 lg:grid-cols-3'>
@@ -4164,11 +4159,8 @@ const ViewProject = () => {
<div className='mt-5 h-80 md:mt-0' id='dataChart' />
</div>
{dataLoading ? (
- <div className='static mt-4 !bg-transparent' id='loader'>
- <div className='loader-head dark:!bg-slate-800'>
- <div className='first dark:!bg-slate-600' />
- <div className='second dark:!bg-slate-600' />
- </div>
+ <div className='mt-4'>
+ <LoadingBar />
</div>
) : null}
</div>
diff --git a/web/app/styles/index.css b/web/app/styles/index.css
index be6e754ac..ed7bd3307 100644
--- a/web/app/styles/index.css
+++ b/web/app/styles/index.css
@@ -1,75 +1,30 @@
-.loader-head {
- background-color: #c6dafc;
- height: 4px;
- overflow: hidden;
- position: relative;
-}
-
-.loader-head .first,
-.loader-head .second {
- background-color: #4f46e5;
- bottom: 0;
- left: 0;
- right: 0;
- top: 0;
- position: absolute;
- -webkit-transform-origin: left center;
- -moz-transform-origin: left center;
- transform-origin: left center;
- -webkit-transform: scaleX(0);
- -moz-transform: scaleX(0);
- transform: scaleX(0);
-}
-
-.loader-head .first {
- -webkit-animation: first 2s linear infinite;
- -moz-animation: first 2s linear infinite;
- animation: first 2s linear infinite;
-}
-
-.loader-head .second {
- -webkit-animation: second 2s linear infinite;
- -moz-animation: second 2s linear infinite;
- animation: second 2s linear infinite;
-}
-
-@keyframes first {
+@keyframes indeterminate1 {
0% {
- transform: translate(0) scaleX(0);
- }
-
- 25% {
- transform: translate(0) scaleX(0.5);
+ left: -35%;
+ right: 100%;
}
-
- 50% {
- transform: translate(25%) scaleX(0.75);
- }
-
- 75% {
- transform: translate(100%) scaleX(0);
+ 60% {
+ left: 100%;
+ right: -90%;
}
-
100% {
- transform: translate(100%) scaleX(0);
+ left: 100%;
+ right: -90%;
}
}
-@keyframes second {
+@keyframes indeterminate2 {
0% {
- transform: translate(0) scaleX(0);
+ left: -200%;
+ right: 100%;
}
-
60% {
- transform: translate(0) scaleX(0);
- }
-
- 80% {
- transform: translate(0) scaleX(0.6);
+ left: 107%;
+ right: -8%;
}
-
100% {
- transform: translate(100%) scaleX(0.1);
+ left: 107%;
+ right: -8%;
}
}
diff --git a/web/app/ui/LoadingBar.tsx b/web/app/ui/LoadingBar.tsx
new file mode 100644
index 000000000..548edf178
--- /dev/null
+++ b/web/app/ui/LoadingBar.tsx
@@ -0,0 +1,42 @@
+import cx from 'clsx'
+import React from 'react'
+
+interface LoadingBarProps {
+ className?: string
+}
+
+const LoadingBar: React.FC<LoadingBarProps> = ({ className }) => {
+ return (
+ <div
+ className={cx('relative h-1 w-full overflow-hidden rounded-full bg-gray-200/60 dark:bg-gray-700/60', className)}
+ >
+ {/* First indeterminate bar */}
+ <div
+ className='absolute h-full rounded-full bg-gradient-to-r from-indigo-500 to-blue-600 opacity-90 shadow-sm'
+ style={{
+ animation: 'indeterminate1 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite',
+ }}
+ />
+
+ {/* Second indeterminate bar */}
+ <div
+ className='absolute h-full rounded-full bg-gradient-to-r from-indigo-500 to-blue-600 opacity-75 shadow-sm'
+ style={{
+ animation: 'indeterminate2 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) infinite',
+ animationDelay: '1.15s',
+ }}
+ />
+
+ {/* Subtle glow effect */}
+ <div
+ className='absolute h-full rounded-full bg-gradient-to-r from-indigo-400/30 via-indigo-500/40 to-indigo-600/30 blur-sm'
+ style={{
+ animation: 'indeterminate1 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite',
+ transform: 'scaleY(1.5)',
+ }}
+ />
+ </div>
+ )
+}
+
+export default LoadingBar