Skip to content

Commit

Permalink
Merge pull request #2357 from IX-Swap/development
Browse files Browse the repository at this point in the history
Staging release v0.6.0 patch 31/05/2024
  • Loading branch information
thi-investax authored May 31, 2024
2 parents dde119d + 4058665 commit 32fa43c
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 79 deletions.
3 changes: 1 addition & 2 deletions src/components/LBP/InvestmentList/LbpCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ export const LbpCard: React.FC<Props> = ({ lbp }) => {
[lbp?.status]
)


const onClick = React.useCallback(() => {
if (!account || isChangeRequested || isPending || isDraft || isRejected || isNotSubmitted) {
toggleKYCModal()
Expand Down Expand Up @@ -107,7 +106,7 @@ export const LbpCard: React.FC<Props> = ({ lbp }) => {

{isClosed && (
<InvestButton type="button" onClick={onClick}>
Learn More
{LbpStatus.closed === lbp.status ? 'Claim Now' : 'Learn More'}
</InvestButton>
)}
</LbpCardFooter>
Expand Down
45 changes: 18 additions & 27 deletions src/components/LBP/PublicDetails/PublicChart.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useCallback, useMemo } from 'react'
import { LineChart, Line, XAxis, YAxis, Tooltip, DefaultTooltipContent } from 'recharts'
import { LineChart, AreaChart, Line, XAxis, YAxis, Tooltip, DefaultTooltipContent, Area } from 'recharts'
import styled from 'styled-components'
import { useWeb3React } from '@web3-react/core'
import { useSubgraphQuery } from 'hooks/useSubgraphQuery'
Expand Down Expand Up @@ -220,12 +220,18 @@ export default function DetailsChart({

return (
<ChartContainer>
<LineChart
<AreaChart
width={chartWidth ? chartWidth : 800}
height={400}
data={dataPoints}
margin={{ top: 5, right: 20, bottom: 5, left: 0 }}
>
<defs>
<linearGradient id="colorValue" x1="0" y1="0" x2="0" y2="1">
<stop offset="0%" stopColor="#6666FF" stopOpacity={0.3} />
<stop offset="100%" stopColor="#6666FF" stopOpacity={0} />
</linearGradient>
</defs>
<defs>
<linearGradient id="gradient" x1="0" y1="0" x2="100%" y2="0">
<stop offset="0%" stopColor="#AFAFCD" />
Expand All @@ -235,34 +241,19 @@ export default function DetailsChart({
</linearGradient>
</defs>
<Tooltip content={<CustomTooltip />} labelFormatter={() => ''} /> {/* Disable default label */}
<Line type="monotone" dataKey="price" strokeWidth={2} stroke="url(#gradient)" dot={false} />
{/* <Line type="monotone" dataKey="price" strokeWidth={2} stroke="url(#gradient)" dot={false} /> */}
<XAxis dataKey="date" axisLine={false} tick={false} />
<XAxis xAxisId="1" dataKey="date" allowDuplicatedCategory={false} axisLine={false} />
<YAxis tick={{ fontSize: 14 }} tickFormatter={(value) => `$${value}`} axisLine={false} />
{/* <ReferenceLine */}
{/* x={launchDate} */}
{/* label={ */}
{/* <g transform="translate(570, 30)"> */}
{/* <circle cx={0} cy={0} r={5} fill="#BDBDDB" /> */}
{/* <Text fontSize={'14px'} x={10} y={5}> */}
{/* Historical Price */}
{/* </Text> */}
{/* </g> */}
{/* } */}
{/* /> */}
{/* <ReferenceLine */}
{/* x={launchDate} */}
{/* y={rand} */}
{/* label={ */}
{/* <g transform="translate(700, 30)"> */}
{/* <circle cx={0} cy={0} r={5} fill="#6666FF" /> */}
{/* <Text fontSize={'14px'} x={10} y={5}> */}
{/* Future Price */}
{/* </Text> */}
{/* </g> */}
{/* } */}
{/* /> */}
</LineChart>
<Area
type="monotone"
dataKey="price"
stroke="url(#gradient)"
strokeWidth={2}
// fillOpacity={1}
fill="url(#colorValue)"
/>
</AreaChart>

<RightLegend>
<WrapItem>
Expand Down
22 changes: 12 additions & 10 deletions src/pages/LBP/components/Graph.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useCallback, useMemo } from 'react'
import styled from 'styled-components'
import { Card } from 'rebass'
import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, Legend, Area } from 'recharts'
import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, Legend, Area, AreaChart } from 'recharts'
import { NewLine } from 'components/Line'
import { ReactComponent as DurationIcon } from '../../../assets/images/group3.svg'
import { ReactComponent as MarketCapIcon } from '../../../assets/images/group1.svg'
Expand Down Expand Up @@ -142,18 +142,20 @@ export default function Graph({ graphData, step, setEndPrice, setStartPrice }: G
Price Discovery Preview
</p>

<LineChart width={332} height={332} data={data} margin={{ top: 20, right: 30, bottom: 10 }}>
<AreaChart width={332} height={332} data={data} margin={{ top: 20, right: 30, bottom: 10 }}>
<CartesianGrid strokeDasharray="3 3" stroke="#8884d8" horizontal={false} vertical={false} />
<XAxis
dataKey="date"
label={{ value: '', position: 'insideBottom', offset: -10 }}
axisLine={false}
tickLine={false}
/>
<defs>
<linearGradient id="colorValue" x1="0" y1="0" x2="0" y2="1">
<stop offset="0%" stopColor="#6666FF" stopOpacity={0.3} />
<stop offset="100%" stopColor="#6666FF" stopOpacity={0} />
</linearGradient>
</defs>
<XAxis dataKey="date" axisLine={false} tick={false} />
<XAxis xAxisId="1" dataKey="date" allowDuplicatedCategory={false} axisLine={false} />
<YAxis dataKey="price" axisLine={false} tickLine={false} />
<Tooltip />
<Line strokeWidth={2.5} dataKey="price" stroke="#8884d8" dot={false} type="monotone" />
</LineChart>
<Area type="monotone" dataKey="price" stroke="#8884d8" fillOpacity={1} fill="url(#colorValue)" />
</AreaChart>

{contentData.map(({ icon: Icon, title, description }, index) => (
<React.Fragment key={index}>
Expand Down
11 changes: 10 additions & 1 deletion src/pages/LBP/components/ProjectInfo/AddSocialLinksModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,16 @@ const AddSocialLinksModal: React.FC<AddSocialLinksModalProps> = ({
if (!selected || !url) {
return
}

if (!isValidUrl(url)) {
setErrorUrl('Please enter valid URL')
return
}
handleAddLink()
onClose()
}


return (
<RedesignedWideModal isOpen={isOpen} onDismiss={onClose}>
<ModalContainer>
Expand Down Expand Up @@ -98,7 +105,9 @@ const AddSocialLinksModal: React.FC<AddSocialLinksModalProps> = ({
</div>

<div style={{ display: 'flex', margin: '20px 0px', gap: '10px' }}>
<PinnedContentButton onClick={handleSubmit}>Add</PinnedContentButton>
<PinnedContentButton onClick={handleSubmit}>
Add
</PinnedContentButton>
<ButtonOutlined onClick={onClose}>Cancel</ButtonOutlined>
</div>
</div>
Expand Down
6 changes: 6 additions & 0 deletions src/pages/LBP/components/ProjectInfo/AdditionalLinksModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ const AdditionalLinksModal: React.FC<AdditionalLinksModalProps> = ({
if (!name || !url) {
return
}

if (!isValidUrl(url)) {
setErrorUrl('Please enter valid URL')
return
}

handleAddLink()
onClose()
}
Expand Down
2 changes: 2 additions & 0 deletions src/pages/LBP/components/ProjectInfo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@ export default function ProjectInfo({ onChange, formData, setDirty }: ProjectInf
if (files.some((file: any) => file.size > MAX_FILE_UPLOAD_SIZE)) {
setIsErrorUploadDocs(true)
return
} else {
setIsErrorUploadDocs(false)
}

const filteredFiles = files.filter((file: any) => file.size <= MAX_FILE_UPLOAD_SIZE)
Expand Down
60 changes: 21 additions & 39 deletions src/pages/LBP/components/Tokenomics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,6 @@ const Tokenomics = ({
const [isOpen, setIsOpen] = useState(false)
const [startDateError, setStartDateError] = useState<string>('')
const [endDateError, setEndDateError] = useState<string>('')
const [startDate, setStartDate] = useState(dayjs())
const [endDate, setEndDate] = useState(dayjs())
const { chainId, account } = useWeb3React()
const [selectedToken, setSelectedToken] = useState<any>({
tokenSymbol: 'USDC',
Expand All @@ -136,22 +134,6 @@ const Tokenomics = ({
shareBalance: '',
})

const [formData, setFormData] = useState<TokenomicsData>({
shareAddress: formDataTokenomics.shareAddress,
xTokenLiteProxyAddress: formDataTokenomics.xTokenLiteProxyAddress,
assetTokenAddress: formDataTokenomics.assetTokenAddress,
assetTokenSymbol: formDataTokenomics.assetTokenSymbol,
shareInput: formDataTokenomics.shareInput,
assetInput: formDataTokenomics.assetInput,
maxSupply: formDataTokenomics.maxSupply,
maxPrice: formDataTokenomics.maxPrice,
startWeight: formDataTokenomics.startWeight,
endWeight: formDataTokenomics.endWeight,
startDate: formDataTokenomics.startDate,
endDate: formDataTokenomics.endDate,
contractAddress: formDataTokenomics.contractAddress,
})

const formik = useFormik({
initialValues: {
shareAddress: '',
Expand Down Expand Up @@ -215,7 +197,6 @@ const Tokenomics = ({
assetTokenAddress: defaultTokenOption.tokenAddress,
assetTokenSymbol: defaultTokenOption.tokenSymbol,
}
setFormData(updatedFormData)
onChange(updatedFormData)
}
}
Expand Down Expand Up @@ -262,7 +243,6 @@ const Tokenomics = ({
startWeight: newStartValue,
endWeight: newEndValue,
}
setFormData(updatedFormData)
onChange(updatedFormData)
}

Expand All @@ -276,7 +256,6 @@ const Tokenomics = ({
startWeight: newStartValue,
endWeight: newEndValue,
}
setFormData(updatedFormData)
onChange(updatedFormData)
}
const handleStartDateChange = (date: Dayjs | null) => {
Expand All @@ -286,14 +265,12 @@ const Tokenomics = ({
setStartDateError("Start date can't be in the past")
} else {
setStartDateError('')
setStartDate(date)
}
const newStartDate = date.local().format('YYYY-MM-DD HH:mm:ss')
const updatedFormData = {
...formDataTokenomics,
startDate: newStartDate,
}
setFormData(updatedFormData)
onChange(updatedFormData)
}
}
Expand All @@ -309,25 +286,19 @@ const Tokenomics = ({
setEndDateError('End date should be at least 1 day bigger than Start Date')
} else {
setEndDateError('')
setEndDate(date)
}
const newEndDate = date.local().format('YYYY-MM-DD HH:mm:ss')
const updatedFormData = {
...formDataTokenomics,
endDate: newEndDate,
}
setFormData(updatedFormData)
onChange(updatedFormData)
}
}

const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {
formik.handleChange(event)
const { name, value } = event.target
setFormData((prevFormData) => ({
...prevFormData,
[name]: value,
}))
onChange({ ...formDataTokenomics, [name]: value })
}

Expand All @@ -343,7 +314,6 @@ const Tokenomics = ({
// logo: selectedOption.logo,
}

setFormData(updatedFormData)
onChange(updatedFormData)
}

Expand All @@ -362,10 +332,6 @@ const Tokenomics = ({
}
}
const handleMaxClick = (balance: string, field: string) => {
setFormData((prevFormData) => ({
...prevFormData,
[field]: balance,
}))
onChange({ ...formDataTokenomics, [field]: balance })
}

Expand All @@ -387,6 +353,8 @@ const Tokenomics = ({
formik.setFieldValue('shareAddress', formDataTokenomics.shareAddress)
formik.setFieldValue('shareInput', formDataTokenomics.shareInput)
formik.setFieldValue('assetInput', formDataTokenomics.assetInput)
setStartValue(formDataTokenomics.startWeight)
setEndValue(formDataTokenomics.endWeight)
}, [formDataTokenomics])

useEffect(() => {
Expand Down Expand Up @@ -456,7 +424,7 @@ const Tokenomics = ({
<TYPE.label fontSize={'14px'}>{shareTitle}</TYPE.label>
</div>
<SpanBal>
Balance: <b>{balances?.shareBalance}</b>
Balance: <b>{formDataTokenomics.shareAddress ? balances?.shareBalance : 0}</b>
</SpanBal>
</TokenomicsItem>
<TokenomicsItem>
Expand All @@ -472,8 +440,13 @@ const Tokenomics = ({
onWheel={(event) => event.currentTarget.blur()}
/>

<MaxWrapper onClick={isEditable ? () => handleMaxClick(balances?.shareBalance, 'shareInput') : undefined}>
<Span style={{ padding: '10px 20px', cursor: 'pointer' }}>Max</Span>
<MaxWrapper>
<Span
style={{ padding: '10px 20px', cursor: 'pointer' }}
onClick={isEditable ? () => handleMaxClick(balances?.shareBalance, 'shareInput') : undefined}
>
Max
</Span>
</MaxWrapper>
</TokenomicsItem>
</TokenomicsContainer>
Expand Down Expand Up @@ -541,8 +514,13 @@ const Tokenomics = ({
value={formDataTokenomics.assetInput}
onWheel={(event) => event.currentTarget.blur()}
/>
<MaxWrapper onClick={isEditable ? () => handleMaxClick(balances?.assetBalance, 'assetInput') : undefined}>
<Span style={{ padding: '10px 20px', cursor: 'pointer' }}>Max</Span>
<MaxWrapper>
<Span
style={{ padding: '10px 20px', cursor: 'pointer' }}
onClick={isEditable ? () => handleMaxClick(balances?.assetBalance, 'assetInput') : undefined}
>
Max
</Span>
</MaxWrapper>
</TokenomicsItem>
</TokenomicsContainer>
Expand Down Expand Up @@ -640,6 +618,8 @@ const Tokenomics = ({
value={formDataTokenomics.startWeight}
onChange={handleChangeStart}
disabled={!isEditable}
min={1}
max={99}
/>
</Stack>
</div>
Expand Down Expand Up @@ -702,6 +682,8 @@ const Tokenomics = ({
value={formDataTokenomics.endWeight ? formDataTokenomics.endWeight : valueEnd}
onChange={handleChangeEnd}
disabled={!isEditable}
min={1}
max={99}
/>
</Stack>
</div>
Expand Down

0 comments on commit 32fa43c

Please sign in to comment.