mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2025-12-12 23:36:00 +00:00
fix(source): cleanup exports (#168)
* rollup - fail when typescript has warnings or errors Currently this is detected when building the docu. Since the developer rarely does that the problem is detected on github. This change allows the developer to discover the error early by failing the build. * removed unused components and exports --------- Co-authored-by: Ulf Gebhardt <ulf.gebhardt@webcraft-media.de>
This commit is contained in:
parent
7d16b2140a
commit
e74fc083ae
@ -1,41 +0,0 @@
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
import { useEffect, useState } from 'react'
|
||||
|
||||
import { useItems } from '#components/Map/hooks/useItems'
|
||||
|
||||
/**
|
||||
* @category AppShell
|
||||
*/
|
||||
export const Sitemap = ({ url }: { url: string }) => {
|
||||
const [sitemap, setSitemap] = useState('')
|
||||
|
||||
const items = useItems()
|
||||
|
||||
useEffect(() => {
|
||||
if (items.length) {
|
||||
const generateSitemap = () => {
|
||||
let sitemapXML = '<?xml version="1.0" encoding="UTF-8"?>\n'
|
||||
sitemapXML += '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\n'
|
||||
|
||||
items.forEach((item) => {
|
||||
sitemapXML += ' <url>\n'
|
||||
sitemapXML += ` <loc>${url}/${item.slug}</loc>\n`
|
||||
sitemapXML += ' </url>\n'
|
||||
})
|
||||
|
||||
sitemapXML += '</urlset>'
|
||||
return sitemapXML
|
||||
}
|
||||
|
||||
setSitemap(generateSitemap())
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [items])
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h1>Sitemap</h1>
|
||||
<textarea value={sitemap} readOnly rows={items.length + 4} cols={80} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@ -1,4 +1,3 @@
|
||||
export * from './AppShell'
|
||||
export { SideBar } from './SideBar'
|
||||
export { Content } from './Content'
|
||||
export { Sitemap } from './Sitemap'
|
||||
|
||||
@ -1,48 +0,0 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
import { useEffect, useRef } from 'react'
|
||||
|
||||
export const CircleLayout = ({
|
||||
items,
|
||||
radius,
|
||||
fontSize,
|
||||
}: {
|
||||
items: any
|
||||
radius: number
|
||||
fontSize: any
|
||||
}) => {
|
||||
const containerRef = useRef<HTMLDivElement>(null)
|
||||
|
||||
useEffect(() => {
|
||||
const container = containerRef.current
|
||||
const itemCount = items.length
|
||||
|
||||
if (container) {
|
||||
for (let i = 0; i < itemCount; i++) {
|
||||
const startAngle = Math.PI / 2
|
||||
const angle = startAngle + (i / itemCount) * (2 * Math.PI)
|
||||
const x = radius * Math.cos(angle)
|
||||
const y = radius * Math.sin(angle)
|
||||
// eslint-disable-next-line security/detect-object-injection
|
||||
const child = container.children[i] as HTMLElement
|
||||
child.style.transform = `translate(${x}px, ${y}px)`
|
||||
}
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [items])
|
||||
|
||||
return (
|
||||
<div
|
||||
className='tw-absolute tw-mx-auto tw-flex tw-justify-center tw-items-center tw-h-full tw-w-full'
|
||||
ref={containerRef}
|
||||
>
|
||||
{items.map((item: any) => (
|
||||
<div key={item} className='tw-absolute' style={{ fontSize }}>
|
||||
{item}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@ -1,64 +0,0 @@
|
||||
import { ChevronLeftIcon, ChevronRightIcon } from '@heroicons/react/24/outline'
|
||||
import { add, format, parse, startOfToday, sub } from 'date-fns'
|
||||
import { useState } from 'react'
|
||||
|
||||
import { LUNAR_MONTH, getLastNewMoon, getNextNewMoon } from '#utils/Moon'
|
||||
|
||||
import { CircleLayout } from './CircleLayout'
|
||||
import { MapOverlayPage } from './MapOverlayPage'
|
||||
|
||||
/**
|
||||
* @category Templates
|
||||
*/
|
||||
export const MoonCalendar = () => {
|
||||
const today = startOfToday()
|
||||
|
||||
const [currMonth, setCurrMonth] = useState(() => format(today, 'MMM-yyyy'))
|
||||
const firstDayOfMonth = parse(currMonth, 'MMM-yyyy', new Date())
|
||||
|
||||
const getPrevMonth = (event: React.MouseEvent<SVGSVGElement>) => {
|
||||
event.preventDefault()
|
||||
const firstDayOfPrevMonth = add(firstDayOfMonth, { months: -1 })
|
||||
setCurrMonth(format(firstDayOfPrevMonth, 'MMM-yyyy'))
|
||||
}
|
||||
|
||||
const getNextMonth = (event: React.MouseEvent<SVGSVGElement>) => {
|
||||
event.preventDefault()
|
||||
const firstDayOfNextMonth = add(firstDayOfMonth, { months: 1 })
|
||||
setCurrMonth(format(firstDayOfNextMonth, 'MMM-yyyy'))
|
||||
}
|
||||
|
||||
return (
|
||||
<MapOverlayPage backdrop className='tw-h-96 tw-w-80'>
|
||||
<p className='tw-self-center tw-text-lg tw-font-bold'>Moon Cycle</p>
|
||||
<div className='tw-relative tw-h-full'>
|
||||
<CircleLayout
|
||||
items={['🌑', '🌒', '🌓', '🌔', '🌕', '🌖', '🌗', '🌘']}
|
||||
radius={80}
|
||||
fontSize={'3em'}
|
||||
/>
|
||||
<CircleLayout
|
||||
items={[
|
||||
format(getLastNewMoon(), 'dd.MM hh:mm'),
|
||||
format(
|
||||
sub(getNextNewMoon(), { seconds: ((LUNAR_MONTH * 86400) / 4) * 3 }),
|
||||
'dd.MM hh:mm',
|
||||
),
|
||||
format(sub(getNextNewMoon(), { seconds: (LUNAR_MONTH * 86400) / 2 }), 'dd.MM hh:mm'),
|
||||
format(sub(getNextNewMoon(), { seconds: (LUNAR_MONTH * 86400) / 4 }), 'dd.MM hh:mm'),
|
||||
]}
|
||||
radius={120}
|
||||
fontSize={'0.8em'}
|
||||
/>
|
||||
</div>
|
||||
<div className='tw-flex tw-flex-row'>
|
||||
<ChevronLeftIcon className='tw-w-6 tw-h-6 tw-cursor-pointer' onClick={getPrevMonth} />
|
||||
<p className='tw-text-center tw-p-1 tw-h-full tw-grow'>
|
||||
from {format(getLastNewMoon(), 'dd.MM')} - to {format(getNextNewMoon(), 'dd.MM')}
|
||||
</p>
|
||||
|
||||
<ChevronRightIcon className='tw-w-6 tw-h-6 tw-cursor-pointer' onClick={getNextMonth} />
|
||||
</div>
|
||||
</MapOverlayPage>
|
||||
)
|
||||
}
|
||||
@ -1,9 +1,7 @@
|
||||
export { CardPage } from './CardPage'
|
||||
export { TitleCard } from './TitleCard'
|
||||
export { MapOverlayPage } from './MapOverlayPage'
|
||||
export { MoonCalendar } from './MoonCalendar'
|
||||
export { SelectUser } from './SelectUser'
|
||||
|
||||
export { OverlayItemsIndexPage } from './OverlayItemsIndexPage'
|
||||
export { AttestationForm } from './AttestationForm'
|
||||
export { MarketView } from './MarketView'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user