mirror of
https://github.com/SteamDeckHomebrew/decky-loader.git
synced 2026-07-10 23:32:00 +00:00
bace5143d2
* Bring back component patch-based tabshook * better injection point * finally fix dumb loading error * fix QAM injection breaking after lock * shut up typescript * fix lock screen focusing issues * Bring back the Valve toaster! * Add support for stable steamos * fix focus bug on lock screen but actually * oops: remove extra console log * shut up typescript again * better fix for lockscreen bug * better probably * actually fix focus issues (WTF) Co-authored-by: AAGaming <aa@mail.catvibers.me>
48 lines
1.3 KiB
TypeScript
48 lines
1.3 KiB
TypeScript
import { ToastData, findModule, joinClassNames } from 'decky-frontend-lib';
|
|
import { FunctionComponent } from 'react';
|
|
|
|
interface ToastProps {
|
|
toast: ToastData;
|
|
}
|
|
|
|
export const toastClasses = findModule((mod) => {
|
|
if (typeof mod !== 'object') return false;
|
|
|
|
if (mod.ToastPlaceholder) {
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
});
|
|
|
|
const templateClasses = findModule((mod) => {
|
|
if (typeof mod !== 'object') return false;
|
|
|
|
if (mod.ShortTemplate) {
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
});
|
|
|
|
const Toast: FunctionComponent<ToastProps> = ({ toast }) => {
|
|
return (
|
|
<div
|
|
style={{ '--toast-duration': `${toast.duration}ms` } as React.CSSProperties}
|
|
onClick={toast.onClick}
|
|
className={joinClassNames(templateClasses.ShortTemplate, toast.className || '')}
|
|
>
|
|
{toast.logo && <div className={templateClasses.StandardLogoDimensions}>{toast.logo}</div>}
|
|
<div className={joinClassNames(templateClasses.Content, toast.contentClassName || '')}>
|
|
<div className={templateClasses.Header}>
|
|
{toast.icon && <div className={templateClasses.Icon}>{toast.icon}</div>}
|
|
<div className={templateClasses.Title}>{toast.title}</div>
|
|
</div>
|
|
<div className={templateClasses.Body}>{toast.body}</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default Toast;
|