Even more code styling things

This commit is contained in:
2023-07-31 12:41:19 +03:00
parent 9eb30d2066
commit 9b35a54ae9
51 changed files with 127 additions and 113 deletions

View File

@ -28,7 +28,7 @@ const styles = {
}
function AnnouncementDetails({ close, refresh, announcement: {
id, name, category, bestBy, description, lat, lng, address, metro, bookedBy, userId
id, name, category, bestBy, description, lat, lng, address, metro, bookedBy, userId,
} }: AnnouncementDetailsProps) {
const { handleBook, bookButton } = useBook()

View File

@ -6,7 +6,7 @@ import { composeSignUpBody } from '../api/signup'
import { composeSignInBody } from '../api/token'
type AuthFormProps = {
register: boolean
register: boolean,
goBack: () => void,
}

View File

@ -5,7 +5,7 @@ import { PropsWithChildren } from 'react'
import BackButton from '../assets/backArrow.svg'
type BackHeaderProps = {
text: string
text: string,
}
function BackHeader({ text, children }: PropsWithChildren<BackHeaderProps>) {

View File

@ -15,22 +15,20 @@ const styles = {
display: 'flex',
flexDirection: 'row',
height: '100%',
margin: 'auto'
margin: 'auto',
} as CSSProperties,
navBarElement: {
width: '100%',
height: '100%',
display: 'flex',
alignItems: 'center',
justifyContent: 'center'
justifyContent: 'center',
} as CSSProperties,
}
type BottomNavBarProps = {
width: number,
toggleFilters: (p: boolean) => void
toggleFilters: (state: boolean) => void,
}
function BottomNavBar({ width, toggleFilters }: BottomNavBarProps) {
@ -38,7 +36,7 @@ function BottomNavBar({ width, toggleFilters }: BottomNavBarProps) {
<div style={styles.navBar}>
<div style={{ ...styles.navBarGroup, width: width }}>
<a style={styles.navBarElement} onClick={() => toggleFilters(true)}>
<a href='#' style={styles.navBarElement} onClick={() => toggleFilters(true)}>
<img src={filterIcon} alt='Фильтровать объявления' title='Фильтровать объявления' />
</a>
@ -46,7 +44,7 @@ function BottomNavBar({ width, toggleFilters }: BottomNavBarProps) {
<img src={addIcon} alt='Опубликовать объявление' title='Опубликовать объявление' />
</Link>
<Link style={styles.navBarElement} to={'/user'} >
<Link style={styles.navBarElement} to='/user' >
<img src={userIcon} alt='Личный кабинет' title='Личный кабинет' />
</Link>

View File

@ -4,7 +4,7 @@ import { Card } from 'react-bootstrap'
import { BackHeader } from '.'
type CardLayoutProps = {
text: string
text: string,
}
const CardLayout = ({ text, children }: PropsWithChildren<CardLayoutProps>) => (

View File

@ -4,7 +4,7 @@ import { useAnnouncements } from '../hooks/api'
import { gotError } from '../hooks/useFetch'
type CategoryPreviewProps = {
category: UserCategory
category: UserCategory,
}
function CategoryPreview({ category }: CategoryPreviewProps) {

View File

@ -10,21 +10,21 @@ type FiltersProps = {
filter: FiltersType,
setFilter: SetState<FiltersType>,
filterShown: boolean,
setFilterShown: SetState<boolean>
setFilterShown: SetState<boolean>,
}
function Filters({ filter, setFilter, filterShown, setFilterShown }: FiltersProps) {
const handleSubmit: FormEventHandler<HTMLFormElement> = (event) => {
event.preventDefault();
event.stopPropagation();
event.preventDefault()
event.stopPropagation()
const formData = new FormData(event.currentTarget)
setFilter(prev => ({
...prev,
category: (formData.get('category') as (FiltersType['category'] | null)) || undefined,
metro: (formData.get('metro') as (FiltersType['metro'] | null)) || undefined
metro: (formData.get('metro') as (FiltersType['metro'] | null)) || undefined,
}))
setFilterShown(false)

View File

@ -3,8 +3,9 @@ import { colors, lineNames, lineByName } from '../assets/metro'
function LineDot({ station }: { station: string }) {
const line = lineByName(station)
if (line == undefined)
if (line == undefined) {
return <></>
}
const lineTitle = lineNames[line]
const color = colors[line]

View File

@ -7,7 +7,7 @@ import { iconItem } from '../utils/markerIcons'
type LocationMarkerProps = {
address: string,
position: LatLng,
setPosition: SetState<LatLng>
setPosition: SetState<LatLng>,
}
function LocationMarker({ address, position, setPosition }: LocationMarkerProps) {
@ -21,7 +21,7 @@ function LocationMarker({ address, position, setPosition }: LocationMarkerProps)
},
resize: () => {
setPosition(map.getCenter())
}
},
})
return (

View File

@ -3,7 +3,7 @@ import { CSSProperties } from 'react'
import handStarsIcon from '../assets/handStars.svg'
type PointsProps = {
points: number
points: number,
}
const styles = {

View File

@ -9,7 +9,7 @@ import signOutIcon from '../assets/signOut.svg'
const styles = {
rightIcon: {
marginLeft: '1rem',
marginRight: 0
marginRight: 0,
} as CSSProperties,
}

View File

@ -58,7 +58,7 @@ const styles = {
} as CSSProperties,
leftScrollButton: {
left: 0,
transform: 'scaleX(-1)'
transform: 'scaleX(-1)',
} as CSSProperties,
rightScrollButton: {
right: 0,
@ -116,7 +116,7 @@ function StoriesPreview({ announcements, category }: StoriesPreviewProps) {
<li key={`${category}${i}`}>
<Link to={'/?' + new URLSearchParams({
...URLEncodeFilters(composeUserCategoriesFilters[category]()),
storyIndex: i.toString()
storyIndex: i.toString(),
}).toString()} style={styles.link}>
{ann.src?.endsWith('mp4') ? (
<video src={ann.src} style={styles.image} />

View File

@ -5,7 +5,10 @@ import { iconTrash } from '../utils/markerIcons'
type TrashboxMarkersProps = {
trashboxes: Trashbox[],
selectTrashbox: ({ index, category }: { index: number, category: string }) => void
selectTrashbox: ({ index, category }: {
index: number,
category: string,
}) => void,
}
function TrashboxMarkers({ trashboxes, selectTrashbox }: TrashboxMarkersProps) {