core/components/Form/Label.tsx
Byungchul Kim e8075ee7d5
feat: support webhook (#514)
* feat: support webhook

* feat: bot webhook

* types: add enums for webhook

* feat: update webhook status by param

* feat: send webhook of server count change

* feat: send webhook of vote

* chore: add desc of faulty webhook

* chore: set initial value

* feat: add collection of clients

* chore: simplify

* feat: set webhook status dynamically

* feat: webhook for discord

* refactor: rename WebhookStatus.Paused

* refactor: make webhookClients to one object

* feat: webhook with fetch

* feat: add warning prop to input component

* feat: display red when warning

* feat: check server count properly

* feat: handle status codes

* refactor: remove double fetch

* chore: typo

* feat: send failed message

* fix: missing id on query

* feat: limit response body

* feat: use severlist bot to dm

* feat: webhook for servers

* feat: use env for ids

* refactor: remove variables

* fix: send discord log

* fix: message

* feat: include koreanbots in footer

* fix: typo

* refactor: export function as non default

* feat: add verification

* feat: add columns

* feat: verify bot webhook

* feat: verify server webhook

* chore: rename key to secret

* fix: stringify

* chore: remove webhook related columns

* refactor: use separate object for webhook

* type: add webhook prop to bot / server

* fix: implement webhook status

* refactor: rename webhook to webhookURL

* feat: select webhook props

* feat: remove bot's private props

* feat: remove server private fields

* chore: use makeURLs

* type: fix faildSince is type as string

* refactor: rename to updateWebhook

* chore: make props optional

* feat: failedSince

* feat: remove failedSince when success

* fix: missing import

* fix: typo

* fix: convert missing prop

* fix: typo

* chore: remove unnecessary select

* fix: missing systax

* feat: sort docs

* feat: use relay

* fix: check status properly

* chore: handle relay server error

* remove awaits

* fix: add base url

* fix: typo

* chore: remove red highlights

* chore: change emoji

---------

Co-authored-by: SKINMAKER <skinmaker@SKINMAKERs-iMac.local>
Co-authored-by: skinmaker1345 <me@skinmaker.dev>
2023-04-03 12:03:41 +09:00

56 lines
1.2 KiB
TypeScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import Tooltip from '@components/Tooltip'
const Label: React.FC<LabelProps> = ({
For,
children,
label,
labelDesc,
error = null,
grid = true,
short = false,
required = false,
warning = false,
warningText
}) => {
return <label
className={grid ? 'grid grid-cols-1 xl:grid-cols-4 gap-2 my-4' : 'inline-flex items-center'}
htmlFor={For}
>
{label && (
<div className='col-span-1 text-sm'>
<h3 className='text-koreanbots-blue text-lg font-bold'>
{label}
{required && (
<span className='align-text-top text-red-500 text-base font-semibold'> *</span>
)}
{warning && (
<Tooltip direction='left' text={warningText}>
<span className='text-red-500 text-base font-semibold pl-1' role='img' aria-label='warning'></span>
</Tooltip>
)}
</h3>
{labelDesc}
</div>
)}
<div className={short ? 'col-span-1' : 'col-span-3'}>
{children}
<div className='mt-1 text-red-500 text-xs font-light'>{error}</div>
</div>
</label>
}
interface LabelProps {
For: string
children: JSX.Element | JSX.Element[]
label?: string
labelDesc?: string | JSX.Element
error?: string | null
grid?: boolean
short?: boolean
required?: boolean
warning?: boolean
warningText?: string | null
}
export default Label