Refactor HProgress component and CSS for improved animation and layout
- Updated the HProgress component to include a mask and wave animation for a more visually appealing progress display. - Adjusted CSS styles in App.css to enhance the animation responsiveness and ensure seamless transitions. - Removed unnecessary postMessage calls in electrobun-bridge.js to streamline message handling. - Cleaned up rpc.js by removing the rendererResponseAck handler for better code clarity.
This commit is contained in:
parent
19cfeff118
commit
578caaffc2
@ -973,10 +973,11 @@ span.ant-skeleton-input.ant-skeleton-input-sm.text-skeleton {
|
|||||||
|
|
||||||
@keyframes h-progress-macos-wave {
|
@keyframes h-progress-macos-wave {
|
||||||
0% {
|
0% {
|
||||||
transform: translateX(-120%);
|
transform: translateX(0);
|
||||||
}
|
}
|
||||||
100% {
|
100% {
|
||||||
transform: translateX(120%);
|
/* One gradient period (40cqw of a 200cqw-wide element) for a seamless loop */
|
||||||
|
transform: translateX(20%);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1000,6 +1001,8 @@ span.ant-skeleton-input.ant-skeleton-input-sm.text-skeleton {
|
|||||||
flex: 1;
|
flex: 1;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
|
/* Lets the wave size itself against the full track via cqw units */
|
||||||
|
container-type: inline-size;
|
||||||
}
|
}
|
||||||
|
|
||||||
.h-progress-bg,
|
.h-progress-bg,
|
||||||
@ -1014,22 +1017,33 @@ span.ant-skeleton-input.ant-skeleton-input-sm.text-skeleton {
|
|||||||
inset-inline-start: 0;
|
inset-inline-start: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.h-progress-bg-active::after {
|
/* Mask that clips the wave to the filled portion of the bar. Its width
|
||||||
content: '';
|
tracks the fill, while the wave inside keeps a constant width so Safari
|
||||||
|
doesn't restart/freeze the animation when progress updates. */
|
||||||
|
.h-progress-bg-mask {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
inset: 0;
|
inset-block: 0;
|
||||||
border-radius: inherit;
|
inset-inline-start: 0;
|
||||||
|
overflow: hidden;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
background: linear-gradient(
|
transition: width 0.1s cubic-bezier(0.78, 0.14, 0.15, 0.86);
|
||||||
|
}
|
||||||
|
|
||||||
|
.h-progress-bg-wave {
|
||||||
|
position: absolute;
|
||||||
|
inset-block: 0;
|
||||||
|
/* Constant width relative to the full track (.h-progress-inner),
|
||||||
|
independent of the mask's changing width. Starts one period early so
|
||||||
|
the pattern always covers the track while sliding right. */
|
||||||
|
inset-inline-start: -40cqw;
|
||||||
|
width: 200cqw;
|
||||||
|
background: repeating-linear-gradient(
|
||||||
90deg,
|
90deg,
|
||||||
rgba(255, 255, 255, 0) 0%,
|
rgba(255, 255, 255, 0) 0,
|
||||||
rgba(255, 255, 255, 0.08) 18%,
|
rgba(255, 255, 255, 0.35) 20cqw,
|
||||||
rgba(255, 255, 255, 0.42) 50%,
|
rgba(255, 255, 255, 0) 40cqw
|
||||||
rgba(255, 255, 255, 0.08) 82%,
|
|
||||||
rgba(255, 255, 255, 0) 100%
|
|
||||||
);
|
);
|
||||||
width: 55%;
|
animation: h-progress-macos-wave 1s linear infinite;
|
||||||
animation: h-progress-macos-wave 1.6s ease-in-out infinite;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.h-progress-text {
|
.h-progress-text {
|
||||||
|
|||||||
@ -176,12 +176,7 @@ const HProgress = forwardRef(function HProgress(
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
className={[
|
className='h-progress-bg'
|
||||||
'h-progress-bg',
|
|
||||||
progressStatus === 'active' ? 'h-progress-bg-active' : null
|
|
||||||
]
|
|
||||||
.filter(Boolean)
|
|
||||||
.join(' ')}
|
|
||||||
style={{
|
style={{
|
||||||
width: `${resolvedPercent}%`,
|
width: `${resolvedPercent}%`,
|
||||||
height: barHeight,
|
height: barHeight,
|
||||||
@ -192,6 +187,14 @@ const HProgress = forwardRef(function HProgress(
|
|||||||
>
|
>
|
||||||
{innerInfo}
|
{innerInfo}
|
||||||
</div>
|
</div>
|
||||||
|
{progressStatus === 'active' && (
|
||||||
|
<div
|
||||||
|
className='h-progress-bg-mask'
|
||||||
|
style={{ width: `${resolvedPercent}%`, borderRadius }}
|
||||||
|
>
|
||||||
|
<div className='h-progress-bg-wave' />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
{successValue != null && (
|
{successValue != null && (
|
||||||
<div
|
<div
|
||||||
className='h-progress-success-bg'
|
className='h-progress-success-bg'
|
||||||
|
|||||||
@ -102,9 +102,6 @@ export function createAppRpc() {
|
|||||||
handlers: {
|
handlers: {
|
||||||
requests: requestHandlers,
|
requests: requestHandlers,
|
||||||
messages: {
|
messages: {
|
||||||
rendererResponseAck: ({ id }) => {
|
|
||||||
console.log('[rpc-diagnostic] renderer received response', id)
|
|
||||||
},
|
|
||||||
rendererRequest: ({ id, method, params }) => {
|
rendererRequest: ({ id, method, params }) => {
|
||||||
const handler = requestHandlers[method]
|
const handler = requestHandlers[method]
|
||||||
if (!handler) {
|
if (!handler) {
|
||||||
|
|||||||
@ -27,13 +27,6 @@ function dispatchMessage(channel, data) {
|
|||||||
|
|
||||||
pendingRequests.delete(data.id)
|
pendingRequests.delete(data.id)
|
||||||
clearTimeout(pendingRequest.timeout)
|
clearTimeout(pendingRequest.timeout)
|
||||||
window.__electrobunBunBridge?.postMessage(
|
|
||||||
JSON.stringify({
|
|
||||||
type: 'message',
|
|
||||||
id: 'rendererResponseAck',
|
|
||||||
payload: { id: data.id }
|
|
||||||
})
|
|
||||||
)
|
|
||||||
|
|
||||||
if (data.success) {
|
if (data.success) {
|
||||||
pendingRequest.resolve(data.result)
|
pendingRequest.resolve(data.result)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user