Skip to content

Commit

Permalink
fix(open-spark): modified code to fix cosmetci UI and code level bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
aniketceminds committed Dec 11, 2024
1 parent bc1a38a commit 6b0cc93
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 19 deletions.
12 changes: 4 additions & 8 deletions apps/open-spark/components/deviceList/AddNewDerModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,14 @@ import { Box, Flex, Image } from '@chakra-ui/react'
import uploadIcon from '@public/images/upload_icon.svg'
import pdfIcon from '@public/images/PDF.svg'
import DragAndDropUpload from '@components/dragAndDropUpload'
import RenderDocuments from '@components/documentsRenderer'
import RenderDocuments, { DocumentProps } from '@components/documentsRenderer'

interface Proofs {
id: number
name: string
date: string
}

interface DocumentProps {
icon: string
title: string
file: any
date: Date
}

interface AddNewDerModalProps {
isOpen: boolean
onClose: () => void
Expand Down Expand Up @@ -94,6 +87,8 @@ const AddNewDerModal = (props: AddNewDerModalProps) => {
flexDir="column"
>
<Input
name="category"
type="text"
value={category}
label="Category"
handleChange={e => setCategory(e.target.value)}
Expand All @@ -113,6 +108,7 @@ const AddNewDerModal = (props: AddNewDerModalProps) => {
/>
<DragAndDropUpload
multiple={true}
accept="image/png, image/jpeg, image/jpg, image/gif, .pdf, .txt"
setFiles={handleFileChange}
fileSelectionElement={(fileInputRef: any) => {
return (
Expand Down
5 changes: 3 additions & 2 deletions apps/open-spark/components/dragAndDropUpload/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ interface DragAndDropUploadProps {
inputRef: React.MutableRefObject<HTMLInputElement | null>
) => React.ReactElement<any, any> | null
setFiles: (files: File[]) => void
accept?: string
}

const DragAndDropUpload = (props: DragAndDropUploadProps) => {
const { fileSelectionElement, multiple, setFiles, dragAndDrop = false } = props
const { fileSelectionElement, multiple, setFiles, dragAndDrop = false, accept } = props
const [isDragging, setIsDragging] = useState(false)

const fileInputRef = useRef<HTMLInputElement | null>(null)
Expand Down Expand Up @@ -68,7 +69,7 @@ const DragAndDropUpload = (props: DragAndDropUploadProps) => {
<Input
type="file"
multiple={multiple}
accept=".json"
accept={accept}
style={{
opacity: 0,
width: '100%',
Expand Down
2 changes: 1 addition & 1 deletion apps/open-spark/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ const Homepage = () => {
<OrderStatusProgress
key={index}
label={data.label}
statusTime={data.statusTime}
statusTime={data.statusTime!}
noLine={data.noLine}
lastElement={data.lastElement}
/>
Expand Down
1 change: 1 addition & 0 deletions apps/open-spark/pages/myCredentials.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ const MyCredentials = () => {
<Typography text="Upload credential documents" />
<DragAndDropUpload
multiple={true}
accept={'.json'}
dragAndDrop={true}
setFiles={handleFileChange}
fileSelectionElement={(fileInputRef: any) => {
Expand Down
7 changes: 1 addition & 6 deletions apps/open-spark/pages/tradeDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ interface TradeMetaData {
preferencesTags: string[]
}

const currentTradeMockData = [
{ name: 'energyToBuy', label: 'Energy Sold', value: '210 (KWh)', disabled: true },
{ name: 'priceFixed', label: 'Price', value: '08 ₹/units', disabled: true }
]

const TradeDetails = () => {
const bearerToken = Cookies.get('authToken')
const strapiUrl = process.env.NEXT_PUBLIC_STRAPI_URL
Expand Down Expand Up @@ -58,7 +53,7 @@ const TradeDetails = () => {
quantity: result.quantity,
date: result.createdAt,
status: result.status,
tradeId: '20',
tradeId: result.id,
tradeEvents: result.trade_events,
preferencesTags: ['Solar', 'Biomass', 'Wind Power']
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export interface OrderStatusProgressProps {
label: string
label: string | React.ReactNode
statusTime: string
className?: string
noLine?: boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export type TextVariant =
| 'tagRegular'

export interface TypographyProps {
text: string
text: string | React.ReactNode
variant?: TextVariant
color?: string
fontFamily?: string
Expand Down

0 comments on commit 6b0cc93

Please sign in to comment.