import { component$ } from '@builder.io/qwik' import { action$, Form, Link, loader$, z, zod$ } from '@builder.io/qwik-city' import { getDatabase } from 'wildebeest/backend/src/database' import { handleRequestGet } from 'wildebeest/functions/api/v1/instance/rules' import { deleteRule, upsertRule } from 'wildebeest/functions/api/wb/settings/server/rules' import { TextArea } from '~/components/Settings/TextArea' export type ServerSettingsData = { rules: string[] } export const addAction = action$( async (data, { platform }) => { let success = false try { const result = await upsertRule(await getDatabase(platform), data.text) success = result.success } catch (e: unknown) { success = false } return { success, } }, zod$({ text: z.string().min(1), }) ) export const deleteAction = action$( async (data, { platform }) => { let success = false try { const result = await deleteRule(await getDatabase(platform), data.id) success = result.success } catch (e: unknown) { success = false } return { success, } }, zod$({ id: z.number(), }) ) export const rulesLoader = loader$>(async ({ platform }) => { const database = await getDatabase(platform) const settingsResp = await handleRequestGet(database) let rules: { id: number; text: string }[] = [] try { rules = await settingsResp.json() } catch { rules = [] } return JSON.parse(JSON.stringify(rules)) }) export default component$(() => { const rules = rulesLoader() const addActionObj = addAction() const deleteActionObj = deleteAction() return ( <>

While most claim to have read and agree to the terms of service, usually people do not read through until after a problem arises. Make it easier to see your server's rules at a glance by providing them in a flat bullet point list. Try to keep individual rules short and simple, but try not to split them up into many separate items either.