-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: estimate aliases in new filter
- Loading branch information
1 parent
0a8c6bd
commit ddcf04c
Showing
25 changed files
with
486 additions
and
422 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,3 @@ | ||
{ | ||
"Year title": "Year", | ||
"Year clue": "If you are selecting only year it means the deadline will be the end of the year. For example: {end}.", | ||
"Quarter title": "Quarter", | ||
"Quarter clue": "This is the date shortcut: Q1, Q2, Q3, Q4. Currently is {quarter}. End is {end}.", | ||
"Date title": "Strict date", | ||
"Date clue": "Or you can choose a date if you have strict deadline.", | ||
"Date is past": "Selected date is past" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,3 @@ | ||
{ | ||
"Year title": "Год", | ||
"Year clue": "Если выбрать только год, то датой будет выбран конец года, например: {end}.", | ||
"Quarter title": "Квартал", | ||
"Quarter clue": "Можно указать квартал: Q1, Q2, Q3, Q4. Сейчас {quarter}, заканчивается {end}.", | ||
"Date title": "Дата", | ||
"Date clue": "Или можно указать точную дату вручную, если есть строгий дедлайн.", | ||
"Date is past": "Выбранная дата уже прошла" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { useContext, createContext, FC, ReactNode } from 'react'; | ||
|
||
import { QuartersAliases, QuartersKeys } from '../../types/date'; | ||
|
||
type ReadOnlyConfig = { | ||
year: boolean; | ||
quarter: boolean; | ||
date: boolean; | ||
}; | ||
|
||
type EstimateContext = { | ||
readOnly: ReadOnlyConfig; | ||
setReadOnly: (update: ReadOnlyConfig | ((cfg: ReadOnlyConfig) => ReadOnlyConfig)) => void; | ||
year?: number; | ||
setYear: (year?: number) => void; | ||
quarter?: QuartersKeys; | ||
setQuarter: (quarter?: QuartersKeys) => void; | ||
quarterAlias?: QuartersAliases; | ||
setQuarterAlias: (alias?: QuartersAliases) => void; | ||
date?: Date | undefined; | ||
setDate: (date?: Date) => void; | ||
}; | ||
|
||
const estimateContext = createContext<EstimateContext>({ | ||
readOnly: { | ||
year: true, | ||
quarter: true, | ||
date: true, | ||
}, | ||
setReadOnly: () => {}, | ||
setYear: () => {}, | ||
setQuarter: () => {}, | ||
setQuarterAlias: () => {}, | ||
setDate: () => {}, | ||
}); | ||
|
||
export const useEstimateContext = () => useContext(estimateContext); | ||
|
||
export const EstimateContextProvider: FC<{ value: EstimateContext; children: ReactNode }> = ({ value, children }) => ( | ||
<estimateContext.Provider value={value}>{children}</estimateContext.Provider> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
{ | ||
"Date input mask": "99/99/9999", | ||
"Date input mask placeholder": "mm/dd/yyyy" | ||
"Date input mask placeholder": "mm/dd/yyyy", | ||
"Date title": "Strict date", | ||
"Date clue": "Or you can choose a date if you have strict deadline." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
{ | ||
"Date input mask": "99.99.9999", | ||
"Date input mask placeholder": "dd.mm.yyyy" | ||
"Date input mask placeholder": "dd.mm.yyyy", | ||
"Date title": "Дата", | ||
"Date clue": "Или можно указать точную дату вручную, если есть строгий дедлайн." | ||
} |
Oops, something went wrong.