import { Context } from "hono"; import { APP_NAME } from "../siteinfo"; import { getViolationsForCurrentUser } from "../utils/db/violations"; type ViolationNoticeProps = { ctx: Context; } export async function ViolationNoticeBar(props: ViolationNoticeProps) { const ctx: Context = props.ctx; const violationData = await getViolationsForCurrentUser(ctx); if (violationData !== null) { let errorStr = ""; if (violationData.tosViolation) { errorStr = `Your account is in violation of ${APP_NAME} usage.`; } else if(violationData.userPassInvalid) { errorStr = "Your Bluesky handle or application password is invalid. Please update these in the settings."; } else if (violationData.accountSuspended) { errorStr = "Your account has been suspended by Bluesky. Some features may not work at this time"; } else if (violationData.accountGone) { errorStr = "Unable to find your BSky account, update your Bluesky handle and app password in the settings"; } else if (violationData.mediaTooBig) { errorStr = "You currently have media that's too large for Bluesky (like a video), please delete those posts"; } return (
WARNING: Account error found! {errorStr}
); } return (); };