mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2025-12-13 07:46:10 +00:00
docs: group by category (#124)
Groups the docs by categories and assigns all exported Components a category (except types).
This commit is contained in:
parent
876d5925e0
commit
93eabedd16
@ -24,7 +24,7 @@
|
|||||||
"test:component": "cypress run --component --browser electron",
|
"test:component": "cypress run --component --browser electron",
|
||||||
"test:unit": "npm run test:unit:dev -- run --coverage",
|
"test:unit": "npm run test:unit:dev -- run --coverage",
|
||||||
"test:unit:dev": "vitest",
|
"test:unit:dev": "vitest",
|
||||||
"docs:generate": "typedoc --plugin typedoc-plugin-coverage src/index.tsx",
|
"docs:generate": "typedoc --navigation.includeCategories true --plugin typedoc-plugin-coverage src/index.tsx",
|
||||||
"update": "npx npm-check-updates"
|
"update": "npx npm-check-updates"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
|
|||||||
@ -4,6 +4,9 @@ import { SetAppState } from './SetAppState'
|
|||||||
|
|
||||||
import type { AssetsApi } from '#types/AssetsApi'
|
import type { AssetsApi } from '#types/AssetsApi'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category AppShell
|
||||||
|
*/
|
||||||
export function AppShell({
|
export function AppShell({
|
||||||
appName,
|
appName,
|
||||||
children,
|
children,
|
||||||
|
|||||||
@ -3,6 +3,9 @@ type ContentProps = {
|
|||||||
children?: React.ReactNode
|
children?: React.ReactNode
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category AppShell
|
||||||
|
*/
|
||||||
export function Content({ children }: ContentProps) {
|
export function Content({ children }: ContentProps) {
|
||||||
return (
|
return (
|
||||||
<div className='tw-flex tw-flex-col tw-w-full tw-h-full tw-bg-base-200 tw-relative'>
|
<div className='tw-flex tw-flex-col tw-w-full tw-h-full tw-bg-base-200 tw-relative'>
|
||||||
|
|||||||
@ -20,6 +20,9 @@ type route = {
|
|||||||
blank?: boolean
|
blank?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category AppShell
|
||||||
|
*/
|
||||||
export function SideBar({ routes, bottomRoutes }: { routes: route[]; bottomRoutes?: route[] }) {
|
export function SideBar({ routes, bottomRoutes }: { routes: route[]; bottomRoutes?: route[] }) {
|
||||||
// prevent react18 from calling useEffect twice
|
// prevent react18 from calling useEffect twice
|
||||||
const init = useRef(false)
|
const init = useRef(false)
|
||||||
|
|||||||
@ -3,6 +3,9 @@ import { useEffect, useState } from 'react'
|
|||||||
|
|
||||||
import { useItems } from '#components/Map/hooks/useItems'
|
import { useItems } from '#components/Map/hooks/useItems'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category AppShell
|
||||||
|
*/
|
||||||
export const Sitemap = ({ url }: { url: string }) => {
|
export const Sitemap = ({ url }: { url: string }) => {
|
||||||
const [sitemap, setSitemap] = useState('')
|
const [sitemap, setSitemap] = useState('')
|
||||||
|
|
||||||
|
|||||||
@ -11,6 +11,9 @@ import { MapOverlayPage } from '#components/Templates/MapOverlayPage'
|
|||||||
|
|
||||||
import { useAuth } from './useAuth'
|
import { useAuth } from './useAuth'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Auth
|
||||||
|
*/
|
||||||
export function LoginPage() {
|
export function LoginPage() {
|
||||||
const [email, setEmail] = useState<string>('')
|
const [email, setEmail] = useState<string>('')
|
||||||
const [password, setPassword] = useState<string>('')
|
const [password, setPassword] = useState<string>('')
|
||||||
|
|||||||
@ -9,6 +9,9 @@ import { MapOverlayPage } from '#components/Templates/MapOverlayPage'
|
|||||||
|
|
||||||
import { useAuth } from './useAuth'
|
import { useAuth } from './useAuth'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Auth
|
||||||
|
*/
|
||||||
// eslint-disable-next-line react/prop-types
|
// eslint-disable-next-line react/prop-types
|
||||||
export function RequestPasswordPage({ resetUrl }) {
|
export function RequestPasswordPage({ resetUrl }) {
|
||||||
const [email, setEmail] = useState<string>('')
|
const [email, setEmail] = useState<string>('')
|
||||||
|
|||||||
@ -8,6 +8,9 @@ import { MapOverlayPage } from '#components/Templates/MapOverlayPage'
|
|||||||
|
|
||||||
import { useAuth } from './useAuth'
|
import { useAuth } from './useAuth'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Auth
|
||||||
|
*/
|
||||||
export function SetNewPasswordPage() {
|
export function SetNewPasswordPage() {
|
||||||
const [password, setPassword] = useState<string>('')
|
const [password, setPassword] = useState<string>('')
|
||||||
|
|
||||||
|
|||||||
@ -11,6 +11,9 @@ import { MapOverlayPage } from '#components/Templates/MapOverlayPage'
|
|||||||
|
|
||||||
import { useAuth } from './useAuth'
|
import { useAuth } from './useAuth'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Auth
|
||||||
|
*/
|
||||||
export function SignupPage() {
|
export function SignupPage() {
|
||||||
const [email, setEmail] = useState<string>('')
|
const [email, setEmail] = useState<string>('')
|
||||||
const [userName, setUserName] = useState<string>('')
|
const [userName, setUserName] = useState<string>('')
|
||||||
|
|||||||
@ -45,6 +45,9 @@ const AuthContext = createContext<AuthContextProps>({
|
|||||||
passwordReset: () => Promise.reject(Error('Unimplemented')),
|
passwordReset: () => Promise.reject(Error('Unimplemented')),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Auth
|
||||||
|
*/
|
||||||
export const AuthProvider = ({ userApi, children }: AuthProviderProps) => {
|
export const AuthProvider = ({ userApi, children }: AuthProviderProps) => {
|
||||||
const [user, setUser] = useState<UserItem | null>(null)
|
const [user, setUser] = useState<UserItem | null>(null)
|
||||||
const [token, setToken] = useState<string | null>(null)
|
const [token, setToken] = useState<string | null>(null)
|
||||||
|
|||||||
@ -1,5 +1,8 @@
|
|||||||
import { useEffect } from 'react'
|
import { useEffect } from 'react'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Gaming
|
||||||
|
*/
|
||||||
export function Modal({
|
export function Modal({
|
||||||
children,
|
children,
|
||||||
showOnStartup,
|
showOnStartup,
|
||||||
|
|||||||
@ -7,6 +7,9 @@ import { useQuestsOpen, useSetQuestOpen } from './hooks/useQuests'
|
|||||||
|
|
||||||
import type { Item } from '#types/Item'
|
import type { Item } from '#types/Item'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Gaming
|
||||||
|
*/
|
||||||
export function Quests() {
|
export function Quests() {
|
||||||
const questsOpen = useQuestsOpen()
|
const questsOpen = useQuestsOpen()
|
||||||
const setQuestsOpen = useSetQuestOpen()
|
const setQuestsOpen = useSetQuestOpen()
|
||||||
|
|||||||
@ -17,6 +17,9 @@ type SelectBoxProps = {
|
|||||||
labelDescription?: string
|
labelDescription?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Input
|
||||||
|
*/
|
||||||
export function SelectBox(props: SelectBoxProps) {
|
export function SelectBox(props: SelectBoxProps) {
|
||||||
const {
|
const {
|
||||||
labelTitle,
|
labelTitle,
|
||||||
|
|||||||
@ -22,6 +22,9 @@ interface KeyValue {
|
|||||||
[key: string]: string
|
[key: string]: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Input
|
||||||
|
*/
|
||||||
export function TextAreaInput({
|
export function TextAreaInput({
|
||||||
labelTitle,
|
labelTitle,
|
||||||
dataField,
|
dataField,
|
||||||
|
|||||||
@ -18,6 +18,9 @@ type InputTextProps = {
|
|||||||
updateFormValue?: (value: string) => void
|
updateFormValue?: (value: string) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Input
|
||||||
|
*/
|
||||||
export function TextInput({
|
export function TextInput({
|
||||||
labelTitle,
|
labelTitle,
|
||||||
labelStyle,
|
labelStyle,
|
||||||
|
|||||||
@ -2,6 +2,9 @@ import { Children, cloneElement, isValidElement, useEffect } from 'react'
|
|||||||
|
|
||||||
import type { Item } from '#types/Item'
|
import type { Item } from '#types/Item'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Map
|
||||||
|
*/
|
||||||
export const ItemForm = ({
|
export const ItemForm = ({
|
||||||
children,
|
children,
|
||||||
item,
|
item,
|
||||||
|
|||||||
@ -2,6 +2,9 @@ import { Children, cloneElement, isValidElement } from 'react'
|
|||||||
|
|
||||||
import type { Item } from '#types/Item'
|
import type { Item } from '#types/Item'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Map
|
||||||
|
*/
|
||||||
export const ItemView = ({ children, item }: { children?: React.ReactNode; item?: Item }) => {
|
export const ItemView = ({ children, item }: { children?: React.ReactNode; item?: Item }) => {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@ -27,6 +27,9 @@ import type { Tag } from '#types/Tag'
|
|||||||
import type { Popup } from 'leaflet'
|
import type { Popup } from 'leaflet'
|
||||||
import type { ReactElement, ReactNode } from 'react'
|
import type { ReactElement, ReactNode } from 'react'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Map
|
||||||
|
*/
|
||||||
export const Layer = ({
|
export const Layer = ({
|
||||||
data,
|
data,
|
||||||
children,
|
children,
|
||||||
|
|||||||
@ -7,6 +7,9 @@ import { useSetPermissionData, useSetPermissionApi, useSetAdminRole } from './ho
|
|||||||
import type { ItemsApi } from '#types/ItemsApi'
|
import type { ItemsApi } from '#types/ItemsApi'
|
||||||
import type { Permission } from '#types/Permission'
|
import type { Permission } from '#types/Permission'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Map
|
||||||
|
*/
|
||||||
export function Permissions({
|
export function Permissions({
|
||||||
data,
|
data,
|
||||||
api,
|
api,
|
||||||
|
|||||||
@ -6,6 +6,9 @@ import { useGetItemTags } from '#components/Map/hooks/useTags'
|
|||||||
|
|
||||||
import type { Item } from '#types/Item'
|
import type { Item } from '#types/Item'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Map
|
||||||
|
*/
|
||||||
export const PopupButton = ({
|
export const PopupButton = ({
|
||||||
url,
|
url,
|
||||||
parameterField,
|
parameterField,
|
||||||
|
|||||||
@ -1,5 +1,8 @@
|
|||||||
import type { Item } from '#types/Item'
|
import type { Item } from '#types/Item'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Map
|
||||||
|
*/
|
||||||
export const PopupCheckboxInput = ({
|
export const PopupCheckboxInput = ({
|
||||||
dataField,
|
dataField,
|
||||||
label,
|
label,
|
||||||
|
|||||||
@ -10,6 +10,9 @@ interface StartEndInputProps {
|
|||||||
updateEndValue?: (value: string) => void
|
updateEndValue?: (value: string) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Map
|
||||||
|
*/
|
||||||
export const PopupStartEndInput = ({
|
export const PopupStartEndInput = ({
|
||||||
item,
|
item,
|
||||||
showLabels = true,
|
showLabels = true,
|
||||||
|
|||||||
@ -2,6 +2,9 @@ import { TextAreaInput } from '#components/Input'
|
|||||||
|
|
||||||
import type { Item } from '#types/Item'
|
import type { Item } from '#types/Item'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Map
|
||||||
|
*/
|
||||||
export const PopupTextAreaInput = ({
|
export const PopupTextAreaInput = ({
|
||||||
dataField,
|
dataField,
|
||||||
placeholder,
|
placeholder,
|
||||||
|
|||||||
@ -2,6 +2,9 @@ import { TextInput } from '#components/Input'
|
|||||||
|
|
||||||
import type { Item } from '#types/Item'
|
import type { Item } from '#types/Item'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Map
|
||||||
|
*/
|
||||||
export const PopupTextInput = ({
|
export const PopupTextInput = ({
|
||||||
dataField,
|
dataField,
|
||||||
placeholder,
|
placeholder,
|
||||||
|
|||||||
@ -1,6 +1,9 @@
|
|||||||
/* eslint-disable @typescript-eslint/prefer-optional-chain */
|
/* eslint-disable @typescript-eslint/prefer-optional-chain */
|
||||||
import type { Item } from '#types/Item'
|
import type { Item } from '#types/Item'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Map
|
||||||
|
*/
|
||||||
export const StartEndView = ({ item }: { item?: Item }) => {
|
export const StartEndView = ({ item }: { item?: Item }) => {
|
||||||
return (
|
return (
|
||||||
<div className='tw-flex tw-flex-row tw-mb-4 tw-mt-1'>
|
<div className='tw-flex tw-flex-row tw-mb-4 tw-mt-1'>
|
||||||
|
|||||||
@ -18,6 +18,9 @@ import { fixUrls, mailRegex } from '#utils/ReplaceURLs'
|
|||||||
import type { Item } from '#types/Item'
|
import type { Item } from '#types/Item'
|
||||||
import type { Tag } from '#types/Tag'
|
import type { Tag } from '#types/Tag'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Map
|
||||||
|
*/
|
||||||
export const TextView = ({
|
export const TextView = ({
|
||||||
item,
|
item,
|
||||||
itemId,
|
itemId,
|
||||||
|
|||||||
@ -7,6 +7,9 @@ import { useSetTagData, useSetTagApi, useTags } from './hooks/useTags'
|
|||||||
import type { ItemsApi } from '#types/ItemsApi'
|
import type { ItemsApi } from '#types/ItemsApi'
|
||||||
import type { Tag } from '#types/Tag'
|
import type { Tag } from '#types/Tag'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Map
|
||||||
|
*/
|
||||||
export function Tags({ data, api }: { data?: Tag[]; api?: ItemsApi<Tag> }) {
|
export function Tags({ data, api }: { data?: Tag[]; api?: ItemsApi<Tag> }) {
|
||||||
const setTagData = useSetTagData()
|
const setTagData = useSetTagData()
|
||||||
const setTagApi = useSetTagApi()
|
const setTagApi = useSetTagApi()
|
||||||
|
|||||||
@ -8,6 +8,9 @@ import { UtopiaMapInner } from './UtopiaMapInner'
|
|||||||
import type { UtopiaMapProps } from '#types/UtopiaMapProps'
|
import type { UtopiaMapProps } from '#types/UtopiaMapProps'
|
||||||
import 'react-toastify/dist/ReactToastify.css'
|
import 'react-toastify/dist/ReactToastify.css'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Map
|
||||||
|
*/
|
||||||
function UtopiaMap({
|
function UtopiaMap({
|
||||||
height = '500px',
|
height = '500px',
|
||||||
width = '100%',
|
width = '100%',
|
||||||
|
|||||||
@ -23,6 +23,9 @@ import type { FormState } from '#types/FormState'
|
|||||||
import type { Item } from '#types/Item'
|
import type { Item } from '#types/Item'
|
||||||
import type { Tag } from '#types/Tag'
|
import type { Tag } from '#types/Tag'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Profile
|
||||||
|
*/
|
||||||
export function ProfileForm() {
|
export function ProfileForm() {
|
||||||
const [state, setState] = useState<FormState>({
|
const [state, setState] = useState<FormState>({
|
||||||
color: '',
|
color: '',
|
||||||
|
|||||||
@ -33,6 +33,9 @@ import type { ItemsApi } from '#types/ItemsApi'
|
|||||||
import type { Tag } from '#types/Tag'
|
import type { Tag } from '#types/Tag'
|
||||||
import type { Marker } from 'leaflet'
|
import type { Marker } from 'leaflet'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Profile
|
||||||
|
*/
|
||||||
export function ProfileView({ attestationApi }: { attestationApi?: ItemsApi<any> }) {
|
export function ProfileView({ attestationApi }: { attestationApi?: ItemsApi<any> }) {
|
||||||
const [item, setItem] = useState<Item>()
|
const [item, setItem] = useState<Item>()
|
||||||
const [updatePermission, setUpdatePermission] = useState<boolean>(false)
|
const [updatePermission, setUpdatePermission] = useState<boolean>(false)
|
||||||
|
|||||||
@ -10,6 +10,9 @@ import { MapOverlayPage } from '#components/Templates'
|
|||||||
|
|
||||||
import type { UserItem } from '#types/UserItem'
|
import type { UserItem } from '#types/UserItem'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Profile
|
||||||
|
*/
|
||||||
export function UserSettings() {
|
export function UserSettings() {
|
||||||
const { user, updateUser, loading /* token */ } = useAuth()
|
const { user, updateUser, loading /* token */ } = useAuth()
|
||||||
|
|
||||||
|
|||||||
@ -11,6 +11,9 @@ import { MapOverlayPage } from './MapOverlayPage'
|
|||||||
import type { Item } from '#types/Item'
|
import type { Item } from '#types/Item'
|
||||||
import type { ItemsApi } from '#types/ItemsApi'
|
import type { ItemsApi } from '#types/ItemsApi'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Templates
|
||||||
|
*/
|
||||||
export const AttestationForm = ({ api }: { api?: ItemsApi<unknown> }) => {
|
export const AttestationForm = ({ api }: { api?: ItemsApi<unknown> }) => {
|
||||||
const items = useItems()
|
const items = useItems()
|
||||||
const appState = useAppState()
|
const appState = useAppState()
|
||||||
|
|||||||
@ -2,6 +2,9 @@ import { Link } from 'react-router-dom'
|
|||||||
|
|
||||||
import { TitleCard } from './TitleCard'
|
import { TitleCard } from './TitleCard'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Templates
|
||||||
|
*/
|
||||||
export function CardPage({
|
export function CardPage({
|
||||||
title,
|
title,
|
||||||
hideTitle,
|
hideTitle,
|
||||||
|
|||||||
@ -3,6 +3,9 @@ import { DomEvent } from 'leaflet'
|
|||||||
import { createRef, useEffect } from 'react'
|
import { createRef, useEffect } from 'react'
|
||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate } from 'react-router-dom'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Templates
|
||||||
|
*/
|
||||||
export function MapOverlayPage({
|
export function MapOverlayPage({
|
||||||
children,
|
children,
|
||||||
className,
|
className,
|
||||||
|
|||||||
@ -30,6 +30,9 @@ function groupAndCount(arr) {
|
|||||||
return grouped.sort((a, b) => b.count - a.count)
|
return grouped.sort((a, b) => b.count - a.count)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Templates
|
||||||
|
*/
|
||||||
export const MarketView = () => {
|
export const MarketView = () => {
|
||||||
const [offers, setOffers] = useState<Tag[]>([])
|
const [offers, setOffers] = useState<Tag[]>([])
|
||||||
const [needs, setNeeds] = useState<Tag[]>([])
|
const [needs, setNeeds] = useState<Tag[]>([])
|
||||||
|
|||||||
@ -7,6 +7,9 @@ import { LUNAR_MONTH, getLastNewMoon, getNextNewMoon } from '#utils/Moon'
|
|||||||
import { CircleLayout } from './CircleLayout'
|
import { CircleLayout } from './CircleLayout'
|
||||||
import { MapOverlayPage } from './MapOverlayPage'
|
import { MapOverlayPage } from './MapOverlayPage'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Templates
|
||||||
|
*/
|
||||||
export const MoonCalendar = () => {
|
export const MoonCalendar = () => {
|
||||||
const today = startOfToday()
|
const today = startOfToday()
|
||||||
|
|
||||||
|
|||||||
@ -27,6 +27,9 @@ import { MapOverlayPage } from './MapOverlayPage'
|
|||||||
|
|
||||||
import type { Item } from '#types/Item'
|
import type { Item } from '#types/Item'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Templates
|
||||||
|
*/
|
||||||
export const OverlayItemsIndexPage = ({
|
export const OverlayItemsIndexPage = ({
|
||||||
url,
|
url,
|
||||||
layerName,
|
layerName,
|
||||||
|
|||||||
@ -7,6 +7,9 @@ import { useItems } from '#components/Map/hooks/useItems'
|
|||||||
|
|
||||||
import { MapOverlayPage } from './MapOverlayPage'
|
import { MapOverlayPage } from './MapOverlayPage'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Templates
|
||||||
|
*/
|
||||||
export const SelectUser = () => {
|
export const SelectUser = () => {
|
||||||
const appState = useAppState()
|
const appState = useAppState()
|
||||||
const items = useItems()
|
const items = useItems()
|
||||||
|
|||||||
@ -11,6 +11,9 @@ interface TitleCardProps {
|
|||||||
TopSideButtons?: any
|
TopSideButtons?: any
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Templates
|
||||||
|
*/
|
||||||
export function TitleCard({
|
export function TitleCard({
|
||||||
title,
|
title,
|
||||||
hideTitle,
|
hideTitle,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user