Skip to content

Commit

Permalink
Convert BuyParts Component to typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
AbdulrhmnGhanem committed Oct 6, 2024
1 parent 14669eb commit b750bcc
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 223 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ import React, { useEffect, useState } from 'react'
import { Icon, Table } from 'semantic-ui-react'
import DoubleScrollBar from 'react-double-scrollbar'

import { array, bool, func, number, string } from 'prop-types'
import styles from './Bom.module.scss'
import TsvTable from './TsvTable'

const Bom = ({ length, parts, tsv }) => {
const Bom = ({ length, parts, tsv }: BomProps) => {
const [diff, setDiff] = useState(0)
const [collapsed, setCollapsed] = useState(true)

Expand All @@ -32,7 +31,7 @@ const Bom = ({ length, parts, tsv }) => {
)
}

const ExpandBom = ({ diff, collapsed, setCollapsed }) => {
const ExpandBom = ({ diff, collapsed, setCollapsed }: ExpandBomProps) => {
const summary =
diff > 0 && collapsed ? (
<tr className={styles.expandSummary}>
Expand Down Expand Up @@ -71,16 +70,16 @@ const ExpandBom = ({ diff, collapsed, setCollapsed }) => {
)
}

Bom.propTypes = {
length: number.isRequired,
parts: array.isRequired,
tsv: string.isRequired,
interface BomProps {
length: number
parts: Array<any>
tsv: string
}

ExpandBom.propTypes = {
diff: number.isRequired,
collapsed: bool.isRequired,
setCollapsed: func.isRequired,
interface ExpandBomProps {
diff: number
collapsed: boolean
setCollapsed: (collapsed: boolean) => void
}

export default Bom
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import React, { useEffect, useState, useCallback } from 'react'

import { array, number } from 'prop-types'
import DigikeyData from '1-click-bom-minimal/lib/data/digikey.json'
import FarnellData from '1-click-bom-minimal/lib/data/farnell.json'
import countriesData from '1-click-bom-minimal/lib/data/countries.json'

const DirectStores = ({ items, multiplier }) => {
const DirectStores = ({ items, multiplier }: DirectStoresProps) => {
const [countryCode, setCountryCode] = useState('Other')
const [digikeyParts, setDigikeyParts] = useState([])
const [farnellParts, setFarnellParts] = useState([])
Expand Down Expand Up @@ -132,8 +131,8 @@ const DirectStores = ({ items, multiplier }) => {
)
}

DirectStores.propTypes = {
items: array.isRequired,
multiplier: number.isRequired,
interface DirectStoresProps {
items: Array<any>
multiplier: number
}
export default DirectStores
105 changes: 0 additions & 105 deletions frontend/src/components/Board/BuyParts/InstallPrompt.jsx

This file was deleted.

14 changes: 0 additions & 14 deletions frontend/src/components/Board/BuyParts/InstallPrompt.module.scss

This file was deleted.

1 change: 1 addition & 0 deletions frontend/src/components/Board/BuyParts/index.module.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@import '../../breakpoint.scss';

.notSelectable {
-webkit-user-select: none;
user-select: none;
cursor: default;
}
Expand Down
Loading

0 comments on commit b750bcc

Please sign in to comment.