Skip to content
This repository has been archived by the owner on Feb 16, 2024. It is now read-only.

fix: initial contract form #41

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mayuran-deriv
Copy link
Contributor

No description provided.

type ThintValuesAndMessages = Record<string, TTimeFrameConfig>;

const hintValuesAndMessages: ThintValuesAndMessages = {
minutes: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be created dynamically based on contracts_for response.

const handleDurationToggle = () => setDurationOpen(prev => !prev);

const handleDurationSelect = (value: string) => setSelectedDuration(value);
const dropDownValues = [t('duration'), t('end time')];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const dropDownValues = [t('duration'), t('end time')];
const dropDownValues = [t('Duration'), t('End time')];

const DurationAndTimeout = () => {
const { t } = useTranslation();
const [isDurationOpen, setDurationOpen] = useState(false);
const [selectedDuration, setSelectedDuration] = useState(t('duration'));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be using a key to keep track of the selection. It we use the translated value it won't work properly when we switch language.

import { useState } from 'react';
import DurationIndex from './duration/DurationIndex';

const DurationAndTimeout = () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const DurationAndTimeout = () => {
const DurationTypeDropdown = () => {

const DurationIndex = () => {
const { t } = useTranslation();

const [selectedTimeFrame, setSelectedTimeFrame] = useState(t('minutes'));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. Use keys to keep track of the selection.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants