diff --git a/functions/src/api/routes/faq/faq.ts b/functions/src/api/routes/faq/faq.ts index ab5d30b9..cacbd3ea 100644 --- a/functions/src/api/routes/faq/faq.ts +++ b/functions/src/api/routes/faq/faq.ts @@ -46,7 +46,7 @@ export const faqRoutes = (fastify: FastifyInstance, options: any, done: () => an { schema: { tags: ['faq'], - summary: + description: 'Add a new item in the FAQ. If the question id is provided, and the question with the same id already exist, it will be updated instead of created.', body: Faq, response: { @@ -78,7 +78,7 @@ export const faqRoutes = (fastify: FastifyInstance, options: any, done: () => an { schema: { tags: ['faq'], - summary: + description: 'Get the FAQ details (publicly used by OpenPlanner public frontend). If you pass a faqPrivateId, it will only return the private FAQ for that ID', response: { 200: GetReply, diff --git a/functions/src/api/routes/sessions/sessions.ts b/functions/src/api/routes/sessions/sessions.ts index 4c3b6542..758f4491 100644 --- a/functions/src/api/routes/sessions/sessions.ts +++ b/functions/src/api/routes/sessions/sessions.ts @@ -53,7 +53,7 @@ export const sessionsRoutes = (fastify: FastifyInstance, options: any, done: () '/v1/:eventId/sessions/:sessionId/shortvid', { schema: { - tags: ['session'], + tags: ['sessions'], summary: 'Generate the session announcement video using shortvid.io API.', querystring: { type: 'object', diff --git a/functions/src/api/routes/sessionsSpeakers/sessionsSpeakers.ts b/functions/src/api/routes/sessionsSpeakers/sessionsSpeakers.ts index de3d4580..0e762e63 100644 --- a/functions/src/api/routes/sessionsSpeakers/sessionsSpeakers.ts +++ b/functions/src/api/routes/sessionsSpeakers/sessionsSpeakers.ts @@ -178,7 +178,8 @@ export const sessionsSpeakers = (fastify: FastifyInstance, options: any, done: ( { schema: { tags: ['speakers', 'sessions'], - summary: + summary: 'Write sessions and speakers', + description: 'Overwrite sessions and speakers: if any data exist before, each filed given in the body will rewrite the corresponding data. ' + 'Tracks, formats and categories will only be created if none exist before and if you provide an id and a name. If track, format or category does exist, the ID will be matched again the trackName or the trackId, same for categories and formats.', body: SpeakersSessionsType, diff --git a/functions/src/api/swagger.ts b/functions/src/api/swagger.ts index f9d02010..14bb349d 100644 --- a/functions/src/api/swagger.ts +++ b/functions/src/api/swagger.ts @@ -6,7 +6,7 @@ export const registerSwagger = (fastify: FastifyInstance) => { fastify.register(FastifySwagger, { swagger: { info: { - title: 'OpenPlanner API', + title: 'OpenPlanner API Documentation', version: '1.0.0', }, host: 'api.openplanner.fr/', @@ -30,8 +30,9 @@ export const registerSwagger = (fastify: FastifyInstance) => { fastify.register(FastifySwaggerUi, { routePrefix: '/', uiConfig: { - docExpansion: 'full', + docExpansion: 'list', deepLinking: false, + tryItOutEnabled: true, }, }) } diff --git a/src/components/form/TextFieldElementPrivate.tsx b/src/components/form/TextFieldElementPrivate.tsx new file mode 100644 index 00000000..7c9eaec8 --- /dev/null +++ b/src/components/form/TextFieldElementPrivate.tsx @@ -0,0 +1,82 @@ +import * as React from 'react' +import { TextFieldElement, TextFieldElementProps } from 'react-hook-form-mui' +import { Box, IconButton, InputAdornment } from '@mui/material' +import { useController } from 'react-hook-form' +import { ContentCopy, Visibility, VisibilityOff } from '@mui/icons-material' +import { useCopyToClipboard } from '../../context/copyToClipboardHook' +import { useState } from 'react' + +export type TextFieldElementPrivateProps = { + required?: boolean + fullWidth?: boolean + name: string + id: string + label: string + helperText?: string + disabled?: boolean + visibleChars?: number + showFullText?: boolean +} + +export const TextFieldElementPrivate = (props: TextFieldElementPrivateProps & TextFieldElementProps) => { + const { field } = useController({ name: props.name }) + const copyAction = useCopyToClipboard() + const [showFullText, setShowFullText] = useState(props.showFullText === undefined ? false : props.showFullText) + const visibleChars = props.visibleChars || 8 + + const copyToClipboard = () => { + copyAction(field.value) + } + + const toggleVisibility = () => { + setShowFullText(!showFullText) + } + + const getMaskedValue = () => { + if (!field.value) return '' + if (showFullText) return field.value + + const valueStr = String(field.value) + const halfVisible = Math.floor(visibleChars / 2) + + if (valueStr.length <= visibleChars) return valueStr + + const firstPart = valueStr.substring(0, halfVisible) + const lastPart = valueStr.substring(valueStr.length - halfVisible) + const middleBullets = '•'.repeat(Math.max(10, valueStr.length - visibleChars)) + + return firstPart + middleBullets + lastPart + } + + return ( + field.onChange(e.target.value)} + type={'text'} + InputProps={{ + value: getMaskedValue(), + endAdornment: ( + + + + {showFullText ? : } + + + + + + + ), + }} + /> + ) +} diff --git a/src/components/form/TextFieldElementWithGenerateApiKeyButton.tsx b/src/components/form/TextFieldElementWithGenerateApiKeyButton.tsx index f1f0efc4..8e23a9c9 100644 --- a/src/components/form/TextFieldElementWithGenerateApiKeyButton.tsx +++ b/src/components/form/TextFieldElementWithGenerateApiKeyButton.tsx @@ -1,11 +1,9 @@ -import * as React from 'react' -import { TextFieldElement } from 'react-hook-form-mui' import { Box, Button, IconButton, InputAdornment } from '@mui/material' import { generateApiKey } from '../../utils/generateApiKey' import { useController } from 'react-hook-form' import { ContentCopy } from '@mui/icons-material' import { useCopyToClipboard } from '../../context/copyToClipboardHook' - +import { TextFieldElementPrivate } from './TextFieldElementPrivate' export type TextFieldElementWithGenerateApiKeyButtonProps = { required: boolean fullWidth: boolean @@ -26,7 +24,7 @@ export const TextFieldElementWithGenerateApiKeyButton = (props: TextFieldElement return ( <> - { - + Dynamic API (slow, not cached, read/write, work in progress) Docs + { Other stuffs - { disabled={formState.isSubmitting} /> - + + + + + Updated on {DateTime.fromISO(event.generatedAt).toLocaleString(DateTime.DATETIME_FULL)} + + ) }