@autobusal/common 0.0.40 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/ApiDetails/ApiDetails.tsx +50 -0
  2. package/ApiDetails/Content.tsx +48 -0
  3. package/ApiDetails/Devpos.tsx +139 -0
  4. package/ApiDetails/services.ts +39 -0
  5. package/ApiDetails/types.ts +13 -0
  6. package/Autocomplete/Autocomplete.tsx +3 -3
  7. package/Avatar.tsx +28 -0
  8. package/{BackTo.tsx → Back/BackTo.tsx} +4 -3
  9. package/Back/BackWithTitle.tsx +30 -0
  10. package/Button/Button.tsx +4 -2
  11. package/Calendar/Calendar.tsx +2 -2
  12. package/{BrowseCompanyItem/BrowseCompanyItem.tsx → CompanyItem/CompanyItem.tsx} +2 -2
  13. package/ContactInfo/ContactInfo.tsx +40 -0
  14. package/ContactInfo/styles.ts +33 -0
  15. package/CookieNotification/CookieNotification.tsx +2 -2
  16. package/File/File.tsx +11 -7
  17. package/IpLogs/IpLogs.tsx +47 -0
  18. package/IpLogs/View.tsx +48 -0
  19. package/IpLogs/services.ts +27 -0
  20. package/IpLogs/styles.ts +10 -0
  21. package/Loading/Loading.tsx +25 -20
  22. package/Loading/Paragraph.tsx +62 -0
  23. package/Loading/styles.ts +34 -1
  24. package/Meta.tsx +1 -1
  25. package/Modal/Modal.tsx +1 -1
  26. package/Pagination/Pagination.tsx +2 -1
  27. package/Passengers/Passengers.tsx +6 -5
  28. package/Passengers/Persons.tsx +7 -7
  29. package/Passengers/{utilities/getText.ts → utilities.ts} +3 -5
  30. package/Password/Password.tsx +4 -3
  31. package/Password/styles.ts +1 -1
  32. package/Policy/services.ts +1 -3
  33. package/Report/Report.tsx +39 -0
  34. package/Report/Send.tsx +52 -0
  35. package/Report/services.ts +19 -0
  36. package/Report/styles.ts +31 -0
  37. package/Report/types.ts +3 -0
  38. package/RouteItem/styles.ts +0 -1
  39. package/Seats/ChooseSeat.tsx +3 -3
  40. package/Seats/Preview.tsx +3 -3
  41. package/Seats/styles.ts +1 -43
  42. package/Table/Actions/Actions.tsx +40 -0
  43. package/Table/Actions/Get.tsx +49 -0
  44. package/Table/Actions/Icon.tsx +54 -0
  45. package/Table/Actions/styles.ts +22 -0
  46. package/Table/Header/Header.tsx +46 -0
  47. package/Table/Header/Sort.tsx +33 -0
  48. package/Table/Header/styles.ts +48 -0
  49. package/Table/Paginate.tsx +34 -0
  50. package/Table/Row.tsx +22 -0
  51. package/Table/Rows/Loading.tsx +22 -0
  52. package/Table/Rows/NotFound.tsx +22 -0
  53. package/Table/Rows/Rows.tsx +63 -0
  54. package/Table/Rows/styles.ts +37 -0
  55. package/Table/Table.tsx +76 -0
  56. package/Table/Top/Search.tsx +36 -0
  57. package/Table/Top/Top.tsx +44 -0
  58. package/Table/Top/styles.ts +32 -0
  59. package/Table/browseUrl.ts +21 -0
  60. package/Table/styles.ts +28 -0
  61. package/Table/types.ts +11 -0
  62. package/Viewer/Actions.tsx +61 -53
  63. package/Viewer/Data.tsx +74 -8
  64. package/Viewer/Item.tsx +10 -81
  65. package/Viewer/Items/CheckboxList.tsx +53 -30
  66. package/Viewer/Items/DatePicker.tsx +70 -0
  67. package/Viewer/Items/Dropdown.tsx +14 -12
  68. package/Viewer/Items/Linked.tsx +27 -0
  69. package/Viewer/Items/TextareaHtml.tsx +51 -24
  70. package/Viewer/Items/styles.ts +73 -0
  71. package/Viewer/Viewer.tsx +24 -17
  72. package/Viewer/styles.ts +21 -1
  73. package/Viewer/types.ts +11 -8
  74. package/index.ts +30 -8
  75. package/package.json +1 -1
  76. package/Pagination/types.ts +0 -12
  77. /package/{BrowseCompanyItem → CompanyItem}/styles.ts +0 -0
@@ -0,0 +1,48 @@
1
+ import { TFunction } from 'i18next';
2
+ import { Table, Row } from '../index';
3
+ import { Container } from './styles';
4
+ import { GetLogs } from './services';
5
+
6
+ interface Props {
7
+ id: number
8
+ page: number
9
+ type: 'admins' | 'agents' | 'financers' | 'operators' | 'visitors'
10
+ t: TFunction<'common'>
11
+ }
12
+
13
+ const View = ({ id, page, type, t }: Props): JSX.Element => {
14
+ const { data, isLoading, isFetching } = GetLogs(id, type, page);
15
+
16
+ const rows = data?.data.map(item => (
17
+ <Row
18
+ key={ item.id }
19
+ id={ item.id }
20
+ data={ [
21
+ item.ip,
22
+ item.created_at
23
+ ] }
24
+ />
25
+ ));
26
+
27
+ return (
28
+ <Container>
29
+ <Table
30
+ url={ `/admin/${ type }/manage/${ id }` }
31
+ columns={ [{
32
+ name: t('ip_logs.ip', { ns: 'common' }),
33
+ width: 80
34
+ }, {
35
+ name: t('ip_logs.date', { ns: 'common' }),
36
+ width: 20
37
+ }] }
38
+ rows={ rows }
39
+ pages={ data }
40
+ loading={ isLoading }
41
+ fetching={ isFetching }
42
+ t={ t }
43
+ />
44
+ </Container>
45
+ );
46
+ };
47
+
48
+ export default View;
@@ -0,0 +1,27 @@
1
+ import { useQuery, UseQueryResult } from '@tanstack/react-query';
2
+ import { apiClient } from '@autobusal/providers';
3
+ import { LogData } from '@autobusal/providers/types/users';
4
+ import { PaginationData } from '@autobusal/providers/types/pagination';
5
+
6
+ export const GetLogs = (id: number, type: string, page: number): UseQueryResult<PaginationData<LogData>> => (
7
+ useQuery({
8
+ queryKey: ['ip-logs', { id, type, page }],
9
+ queryFn: async () => {
10
+ if (id === 0) {
11
+ return null;
12
+ }
13
+
14
+ return await apiClient
15
+ .get('/api/logs', {
16
+ params: {
17
+ id,
18
+ type,
19
+ page
20
+ }
21
+ })
22
+ .then(response => (
23
+ response.data
24
+ ))
25
+ }
26
+ })
27
+ );
@@ -0,0 +1,10 @@
1
+ import styled from 'styled-components';
2
+
3
+ export const Container = styled.div`
4
+ margin-top: 15px;
5
+ `;
6
+
7
+ export const NotAvailable = styled.div`
8
+ font-size: ${ props => props.theme.size.s };
9
+ color: ${ props => props.theme.font.info };
10
+ `;
@@ -1,8 +1,7 @@
1
1
  import { SpinnerRoundFilled, SpinnerCircularFixed } from 'spinners-react';
2
- import { useSystemTheme } from '@autobusal/providers';
3
- import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';
4
- import { ContainerGeneral, ContainerInline, ContainerParagraph } from './styles';
5
- import 'react-loading-skeleton/dist/skeleton.css';
2
+ import { useSystemTheme } from '@autobusal/hooks';
3
+ import Paragraph from './Paragraph';
4
+ import { ContainerGeneral, ContainerInline, ContainerBoxMiddle, ContainerFull } from './styles';
6
5
 
7
6
  export const General = (): JSX.Element => {
8
7
  const theme = useSystemTheme();
@@ -21,7 +20,7 @@ export const General = (): JSX.Element => {
21
20
  : <SpinnerCircularFixed size={ options.size } color={ options.color } speed={ options.speed } thickness={ options.thickness } />
22
21
  }
23
22
  </ContainerGeneral>
24
- )
23
+ );
25
24
  };
26
25
 
27
26
  interface InlineProps {
@@ -47,23 +46,29 @@ export const Inline = ({ text }: InlineProps): JSX.Element => {
47
46
  );
48
47
  };
49
48
 
50
- interface ParagraphProps {
49
+ interface BoxProps {
51
50
  count?: number
52
51
  }
53
52
 
54
- export const Paragraph = ({ count = 3 }: ParagraphProps): JSX.Element => {
55
- const theme = useSystemTheme();
53
+ export const Box = ({ count = 3 }: BoxProps): JSX.Element => (
54
+ <>
55
+ <Paragraph isTitle />
56
56
 
57
- const baseColor = theme === 'light' ? '#EBEBEB' : "#202020";
58
- const highlightColor = theme === 'light' ? '#F5F5F5' : '#444444';
57
+ <div className="box">
58
+ <Paragraph count={ count } />
59
+ </div>
60
+ </>
61
+ );
59
62
 
60
- return (
61
- <SkeletonTheme baseColor={ baseColor } highlightColor={ highlightColor }>
62
- <ContainerParagraph>
63
- <Skeleton count={ count - 1 } /> <br />
64
- <Skeleton count={ count + 1 } /> <br />
65
- <Skeleton count={ count } />
66
- </ContainerParagraph>
67
- </SkeletonTheme>
68
- );
69
- };
63
+ export const BoxMiddle = ({ count = 3 }: BoxProps): JSX.Element => (
64
+ <ContainerBoxMiddle className="box">
65
+ <Paragraph isTitle />
66
+ <Paragraph count={ count } />
67
+ </ContainerBoxMiddle>
68
+ );
69
+
70
+ export const GeneralFull = (): JSX.Element => (
71
+ <ContainerFull>
72
+ <General />
73
+ </ContainerFull>
74
+ );
@@ -0,0 +1,62 @@
1
+ import { useSystemTheme } from '@autobusal/hooks';
2
+ import { getRandomNumber } from '@autobusal/utilities';
3
+ import { ContainerParagraphs, ContainerParagraph, ItemParagraph } from './styles';
4
+
5
+ interface Props {
6
+ count?: number
7
+ isTitle?: boolean
8
+ }
9
+
10
+ const Paragraph = ({ count = 3, isTitle }: Props): JSX.Element => {
11
+ const theme = useSystemTheme();
12
+
13
+ const color = theme === 'light' ? '#EBEBEB' : '#202020';
14
+
15
+ if (isTitle) {
16
+ return (
17
+ <h1>
18
+ <ItemParagraph
19
+ $color={ color }
20
+ $width={ 50 }
21
+ $height={ 27 }
22
+ />
23
+ </h1>
24
+ );
25
+ }
26
+
27
+ const paragraphs = getParagraphs(count, color);
28
+
29
+ return (
30
+ <ContainerParagraphs>
31
+ { paragraphs }
32
+ </ContainerParagraphs>
33
+ );
34
+ };
35
+
36
+ const getParagraphs = (count: number, color: string): JSX.Element[] => {
37
+ const paragraphs: JSX.Element[] = [];
38
+
39
+ for (let i = 1; i <= count; i++) {
40
+ const items: JSX.Element[] = [];
41
+
42
+ for (let j = 1; j <= 3; j++) {
43
+ items.push(
44
+ <ItemParagraph
45
+ key={ 100 * i + j }
46
+ $color={ color }
47
+ $width={ getRandomNumber(60, 100) }
48
+ />
49
+ );
50
+ }
51
+
52
+ paragraphs.push(
53
+ <ContainerParagraph key={ i }>
54
+ { items }
55
+ </ContainerParagraph>
56
+ );
57
+ }
58
+
59
+ return paragraphs;
60
+ };
61
+
62
+ export default Paragraph;
package/Loading/styles.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import styled from 'styled-components';
2
+ import { Middle } from '@layouts/Full/styles';
2
3
 
3
4
  export const ContainerGeneral = styled.div`
4
5
  width: 100%;
@@ -17,6 +18,38 @@ export const ContainerInline = styled.div`
17
18
  color: ${ props => props.theme.font.faded };
18
19
  `;
19
20
 
20
- export const ContainerParagraph = styled.div`
21
+ export const ContainerParagraphs = styled.div`
22
+ display: flex;
23
+ gap: 20px;
24
+ flex-direction: column;
21
25
  padding: 15px 0;
26
+ `;
27
+
28
+ export const ContainerParagraph = styled.div`
29
+ display: flex;
30
+ gap: 9px;
31
+ flex-direction: column;
32
+ `;
33
+
34
+ export const ItemParagraph = styled.div<{
35
+ $color: string
36
+ $width: number
37
+ $height?: number
38
+ }>`
39
+ width: ${ props => props.$width }%;
40
+ height: ${ props => props.$height ? props.$height : 11 }px;
41
+ background: ${ props => props.$color };
42
+ border-radius: 5px;
43
+ `;
44
+
45
+ export const ContainerBoxMiddle = styled(Middle)`
46
+ & > h1 {
47
+ margin-bottom: 15px;
48
+ }
49
+ `;
50
+
51
+ export const ContainerFull = styled.div`
52
+ flex: 1;
53
+ display: flex;
54
+ align-items: center;
22
55
  `;
package/Meta.tsx CHANGED
@@ -4,7 +4,7 @@ interface Props {
4
4
  title: string
5
5
  keywords?: string
6
6
  description?: string
7
- children: JSX.Element | JSX.Element[] | string | null | false | boolean
7
+ children: any
8
8
  }
9
9
 
10
10
  const Meta = ({ title, keywords, description, children }: Props): JSX.Element => (
package/Modal/Modal.tsx CHANGED
@@ -1,6 +1,6 @@
1
1
  import { AiOutlineClose } from 'react-icons/ai';
2
2
  import { useOverflow } from '@autobusal/hooks';
3
- import { Paragraph } from '../index';
3
+ import Paragraph from '../Loading/Paragraph';
4
4
  import { Background, Container, Title, ButtonClose } from './styles';
5
5
 
6
6
  interface Props {
@@ -1,6 +1,6 @@
1
1
  import { TFunction } from 'i18next';
2
2
  import { Container, Left, Right, PageText, PageLink } from './styles';
3
- import { PaginationData } from './types';
3
+ import { PaginationData } from '@autobusal/providers/types/pagination';
4
4
 
5
5
  interface Props {
6
6
  pages: PaginationData<unknown>
@@ -24,6 +24,7 @@ const Pagination = ({ pages, t }: Props): (JSX.Element | null) => {
24
24
  <Container>
25
25
  <Left>
26
26
  { t('pagination.showing', {
27
+ ns: 'common',
27
28
  current: pages.current_page,
28
29
  max: pages.last_page
29
30
  }) }
@@ -2,8 +2,8 @@ import { useState, useEffect, useRef } from 'react';
2
2
  import { TFunction } from 'i18next';
3
3
  import { UseFormRegister, UseFormSetValue } from 'react-hook-form';
4
4
  import { useOutside } from '@autobusal/hooks';
5
- import getText from './utilities/getText';
6
5
  import Persons from './Persons';
6
+ import { getText } from './utilities';
7
7
  import { Container } from './styles';
8
8
 
9
9
  interface Props {
@@ -28,8 +28,9 @@ const Passengers = ({ defaultAdults, defaultChildren, defaultBabies, t, refs, on
28
28
 
29
29
  useEffect(() => {
30
30
  const text = getText(adults, children, babies, t);
31
+
31
32
  setDisplay(text);
32
- }, [adults, children, babies]);
33
+ }, [adults, children, babies, t]);
33
34
 
34
35
  useOutside(ref, () => setShow(false));
35
36
 
@@ -57,9 +58,9 @@ const Passengers = ({ defaultAdults, defaultChildren, defaultBabies, t, refs, on
57
58
 
58
59
  { show &&
59
60
  <Persons
60
- adults={ adults }
61
- children={ children }
62
- babies={ babies }
61
+ adultsNo={ adults }
62
+ childrenNo={ children }
63
+ babiesNo={ babies }
63
64
  t={ t }
64
65
  onChange={ onChange }
65
66
  /> }
@@ -3,20 +3,20 @@ import Person from './Person';
3
3
  import { Passengers } from './styles';
4
4
 
5
5
  interface Props {
6
- adults: number
7
- children: number
8
- babies: number
6
+ adultsNo: number
7
+ childrenNo: number
8
+ babiesNo: number
9
9
  t: TFunction<'common'>
10
10
  onChange: (name: ('adults' | 'children' | 'babies'), amount: number) => void
11
11
  }
12
12
 
13
- const Persons = ({ adults, children, babies, t, onChange }: Props): JSX.Element => (
13
+ const Persons = ({ adultsNo, childrenNo, babiesNo, t, onChange }: Props): JSX.Element => (
14
14
  <Passengers>
15
15
  <Person
16
16
  name="adults"
17
17
  title={ t('data.persons.adult.plural', { ns: 'common' }) }
18
18
  description={ t('data.persons.adult.description', { ns: 'common' }) }
19
- amount={ adults }
19
+ amount={ adultsNo }
20
20
  onChange={ onChange }
21
21
  />
22
22
 
@@ -24,7 +24,7 @@ const Persons = ({ adults, children, babies, t, onChange }: Props): JSX.Element
24
24
  name="children"
25
25
  title={ t('data.persons.child.plural', { ns: 'common' }) }
26
26
  description={ t('data.persons.child.description', { ns: 'common' }) }
27
- amount={ children }
27
+ amount={ childrenNo }
28
28
  onChange={ onChange }
29
29
  />
30
30
 
@@ -32,7 +32,7 @@ const Persons = ({ adults, children, babies, t, onChange }: Props): JSX.Element
32
32
  name="babies"
33
33
  title={ t('data.persons.baby.plural', { ns: 'common' }) }
34
34
  description={ t('data.persons.baby.description', { ns: 'common' }) }
35
- amount={ babies }
35
+ amount={ babiesNo }
36
36
  onChange={ onChange }
37
37
  />
38
38
  </Passengers>
@@ -1,7 +1,7 @@
1
1
  import { TFunction } from 'i18next';
2
2
 
3
- const getText = (adults: number, children: number, babies: number, t: TFunction<'common'>): string => {
4
- let final = [];
3
+ export const getText = (adults: number, children: number, babies: number, t: TFunction<'common'>): string => {
4
+ const final = [];
5
5
 
6
6
  if (adults > 0) {
7
7
  final.push(`${ t('data.persons.adult.plural', { ns: 'common' }) }: ${ adults }`);
@@ -16,6 +16,4 @@ const getText = (adults: number, children: number, babies: number, t: TFunction<
16
16
  }
17
17
 
18
18
  return final.join(', ');
19
- };
20
-
21
- export default getText;
19
+ };
@@ -2,17 +2,18 @@ import { useState } from 'react';
2
2
  import { TFunction } from 'i18next';
3
3
  import { UseFormRegister } from 'react-hook-form';
4
4
  import { AiFillEye, AiFillEyeInvisible } from 'react-icons/ai';
5
- import { validate } from '@autobusal/utilities';
5
+ import { Validate } from '@autobusal/utilities';
6
6
  import { Container } from './styles';
7
7
 
8
8
  interface Props {
9
9
  name: string
10
10
  tabIndex?: number
11
+ validation?: string
11
12
  t: TFunction<'common'>
12
13
  refs: UseFormRegister<any>
13
14
  }
14
15
 
15
- const Password = ({ name, tabIndex, t, refs }: Props): JSX.Element => {
16
+ const Password = ({ name, tabIndex, validation, t, refs }: Props): JSX.Element => {
16
17
  const [ show, setShow ] = useState<boolean>(false);
17
18
 
18
19
  const toggle = (): void => {
@@ -21,7 +22,7 @@ const Password = ({ name, tabIndex, t, refs }: Props): JSX.Element => {
21
22
 
22
23
  return (
23
24
  <Container>
24
- <input type={ show ? 'text' : 'password' } tabIndex={ tabIndex } { ...refs(name, validate('required|min_length:6|max_length:20', t)) } />
25
+ <input type={ show ? 'text' : 'password' } tabIndex={ tabIndex } { ...refs(name, Validate(validation ?? '', t)) } />
25
26
 
26
27
  { show
27
28
  ? <AiFillEye onClick={ toggle } />
@@ -1,4 +1,4 @@
1
- import styled from "styled-components";
1
+ import styled from 'styled-components';
2
2
 
3
3
  export const Container = styled.div`
4
4
  position: relative;
@@ -8,9 +8,7 @@ export const GetPolicy = (id: number): UseQueryResult<PolicyData> => (
8
8
  queryFn: async () => (
9
9
  await apiClient
10
10
  .get('/api/routes/policy', {
11
- params: {
12
- id
13
- }
11
+ params: { id }
14
12
  })
15
13
  .then(response => (
16
14
  response.data
@@ -0,0 +1,39 @@
1
+ import { useState } from 'react';
2
+ import { TFunction } from 'i18next';
3
+ import { MdOutlineBugReport } from 'react-icons/md';
4
+ import Modal from '../Modal/Modal';
5
+ import Send from './Send';
6
+ import { Container, ButtonMore } from './styles';
7
+
8
+ interface Props {
9
+ question: string
10
+ type: string
11
+ margin?: number
12
+ t: TFunction<'common'>
13
+ }
14
+
15
+ const Report = ({ question, type, margin, t }: Props): JSX.Element => {
16
+ const [ show, setShow ] = useState<boolean>(false);
17
+
18
+ return (
19
+ <Container $margin={ margin }>
20
+ <ButtonMore type="button" onClick={ () => setShow(true) }>
21
+ <MdOutlineBugReport />
22
+ { question }
23
+ </ButtonMore>
24
+
25
+ { show && (
26
+ <Modal
27
+ width={ 500 }
28
+ title={ t('report.title', { ns: 'common' }) }
29
+ content={
30
+ <Send type={ type } t={ t } />
31
+ }
32
+ onClose={ () => setShow(false) }
33
+ />
34
+ ) }
35
+ </Container>
36
+ );
37
+ };
38
+
39
+ export default Report;
@@ -0,0 +1,52 @@
1
+ import { TFunction } from 'i18next';
2
+ import { useForm } from 'react-hook-form';
3
+ import { RiCheckFill } from 'react-icons/ri';
4
+ import { Button } from '../index';
5
+ import { Validate, Display } from '@autobusal/utilities';
6
+ import { Success } from './styles';
7
+ import { ReportForm } from './types';
8
+ import { PostReport } from './services';
9
+
10
+ interface Props {
11
+ type: string
12
+ t: TFunction<'common'>
13
+ }
14
+
15
+ const Send = ({ type, t }: Props): JSX.Element => {
16
+ const { register, handleSubmit, formState: { errors } } = useForm<ReportForm>();
17
+
18
+ const { mutate: Send, isPending, isSuccess } = PostReport(type);
19
+
20
+ const onSubmit = (data: ReportForm): void => {
21
+ Send(data);
22
+ };
23
+
24
+ if (isSuccess) {
25
+ return (
26
+ <Success>
27
+ <RiCheckFill />
28
+ { t('report.sent', { ns: 'common' }) }
29
+ </Success>
30
+ );
31
+ }
32
+
33
+ return (
34
+ <form onSubmit={ handleSubmit(onSubmit) }>
35
+ <div className="row">
36
+ { t('report.explain', { ns: 'common' }) }
37
+
38
+ <textarea { ...register('about', Validate('required|min_length:3', t)) } />
39
+
40
+ { Display(errors.about) }
41
+ </div>
42
+
43
+ <Button
44
+ loading={ isPending }
45
+ type="submit"
46
+ text={ t('report.send', { ns: 'common' }) }
47
+ />
48
+ </form>
49
+ );
50
+ };
51
+
52
+ export default Send;
@@ -0,0 +1,19 @@
1
+ import { UseMutationResult, useMutation } from '@tanstack/react-query';
2
+ import { apiClient } from '@autobusal/providers';
3
+ import { ReportForm } from './types';
4
+
5
+ export const PostReport = (type: string): UseMutationResult<void, Error, ReportForm, unknown> => (
6
+ useMutation({
7
+ mutationKey: ['operator-locations-move', { type }],
8
+ mutationFn: async (data: ReportForm) => (
9
+ await apiClient
10
+ .post('/api/reporting/send', {
11
+ ...data,
12
+ type
13
+ })
14
+ .then(response => (
15
+ response.data
16
+ ))
17
+ )
18
+ })
19
+ );
@@ -0,0 +1,31 @@
1
+ import styled, { css } from 'styled-components';
2
+
3
+ export const Container = styled.div<{ $margin?: number }>`
4
+ display: flex;
5
+ ${ props => props.$margin && css<{ $margin?: number }>`
6
+ margin-top: ${ props => props.$margin };
7
+ ` }
8
+ `;
9
+
10
+ export const ButtonMore = styled.button`
11
+ display: flex;
12
+ align-items: center;
13
+ gap: 4px;
14
+ margin-left: auto;
15
+ font-size: ${ props => props.theme.size.xs };
16
+ color: ${ props => props.theme.font.info };
17
+
18
+ &:hover {
19
+ text-decoration: underline;
20
+ }
21
+ `;
22
+
23
+ export const Success = styled.div`
24
+ display: flex;
25
+ align-items: center;
26
+ gap: 10px;
27
+ padding: 25px 0;
28
+ font-weight: 700;
29
+ color: ${ props => props.theme.font.success };
30
+ font-size: ${ props => props.theme.size.l };
31
+ `;
@@ -0,0 +1,3 @@
1
+ export interface ReportForm {
2
+ about: string
3
+ }
@@ -1,6 +1,5 @@
1
1
  import styled, { css } from 'styled-components';
2
2
  import { Link } from 'react-router-dom';
3
- // import { Box } from '@layouts/styles';
4
3
 
5
4
  export const Container = styled.div`
6
5
  padding: 10px;
@@ -3,7 +3,7 @@ import { UseFormRegister } from 'react-hook-form';
3
3
  import { TFunction } from 'i18next';
4
4
  import { FaCheck } from 'react-icons/fa';
5
5
  import { MdEventSeat } from 'react-icons/md';
6
- import { validate } from '@autobusal/utilities';
6
+ import { Validate } from '@autobusal/utilities';
7
7
  import Unavailable from './Unavailable';
8
8
  import Preview from './Preview';
9
9
  import { ButtonSeat } from './styles';
@@ -27,7 +27,7 @@ const ChooseSeat = ({ name, type, defaultValue, bus, picked, validation, t, refs
27
27
  const [ selected, setSelected ] = useState<number>(defaultValue ?? 0);
28
28
 
29
29
  // if we don't have a bus, we just show a notification
30
- if (! bus.bus) {
30
+ if (!bus.bus) {
31
31
  return <Unavailable t={ t } />;
32
32
  }
33
33
 
@@ -61,7 +61,7 @@ const ChooseSeat = ({ name, type, defaultValue, bus, picked, validation, t, refs
61
61
  />
62
62
  ) }
63
63
 
64
- <input type="hidden" defaultValue={ selected } { ...refs(name, validate(validation, t)) } />
64
+ <input type="hidden" defaultValue={ selected } { ...refs(name, Validate(validation, t)) } />
65
65
  </div>
66
66
  );
67
67
  };
package/Seats/Preview.tsx CHANGED
@@ -1,6 +1,6 @@
1
1
  import { TFunction } from 'i18next';
2
2
  import { MdEventSeat } from 'react-icons/md';
3
- import { Modal } from '@autobusal/common';
3
+ import { Modal } from '../index';
4
4
  import { Seats, SeatsInner, ButtonOccupy } from './styles';
5
5
  import { BusData } from '@autobusal/providers/types/buses';
6
6
 
@@ -9,7 +9,7 @@ interface Props {
9
9
  occupied: number[]
10
10
  picked: number[]
11
11
  selected: number
12
- t: TFunction<'general'>
12
+ t: TFunction<'common'>
13
13
  onSelect: (seat: number, occupied: boolean) => void
14
14
  onClose: () => void
15
15
  }
@@ -38,7 +38,7 @@ const Preview = ({ bus, occupied, picked, selected, t, onSelect, onClose }: Prop
38
38
  return (
39
39
  <Modal
40
40
  width={ 1040 }
41
- title={ t('seats.title', { bus: bus.name }) }
41
+ title={ t('seats.title', { ns: 'common', bus: bus.name }) }
42
42
  content={ (
43
43
  <Seats>
44
44
  <SeatsInner $image={ bus.image_url }>