forked from rioukkevin/vscode-git-commit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:rioukkevin/vscode-git-commit
- Loading branch information
Showing
26 changed files
with
613 additions
and
101 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
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
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,43 @@ | ||
import React, { FC, useContext } from 'react'; | ||
import { LineElement } from '../typings/Editor'; | ||
import { IStoreDefaultVariableValue } from '../typings/Store'; | ||
import { Store } from '../utils/store'; | ||
import { parseVariableFromTemplate } from '../utils/template'; | ||
import DefaultVariableValueInput from './core/DefaultVariableValueInput'; | ||
|
||
interface IProps {} | ||
|
||
const DefaultVariablesValuesInput: FC<IProps> = (props) => { | ||
const { | ||
defaultVariablesValues, | ||
setDefaultVariableValue, | ||
template, | ||
variables, | ||
} = useContext(Store); | ||
|
||
const templateVariables = | ||
parseVariableFromTemplate(template as LineElement[]) ?? []; | ||
|
||
const availableVariables = [...templateVariables]; | ||
|
||
const disabledVariables = Object.keys(variables); | ||
|
||
return ( | ||
<div style={{ width: '100%' }}> | ||
{availableVariables.map((av, i) => ( | ||
<DefaultVariableValueInput | ||
key={i} | ||
name={av} | ||
value={defaultVariablesValues[av]} | ||
isDisabled={disabledVariables.includes(av)} | ||
onChange={(value: IStoreDefaultVariableValue) => | ||
setDefaultVariableValue(av, value) | ||
} | ||
onDelete={() => setDefaultVariableValue(av, undefined)} | ||
/> | ||
))} | ||
</div> | ||
); | ||
}; | ||
|
||
export default DefaultVariablesValuesInput; |
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,20 @@ | ||
import React, { FC, useContext } from 'react'; | ||
import { Store } from '../utils/store'; | ||
import Pre from './core/Pre'; | ||
|
||
interface IProps {} | ||
|
||
const DefaultVariablesValuesRenderer: FC<IProps> = (props) => { | ||
const { defaultVariablesValues } = useContext(Store); | ||
return ( | ||
<Pre> | ||
{`"vscodeGitCommit.defaultVariablesValues": ${JSON.stringify( | ||
{ ...defaultVariablesValues }, | ||
null, | ||
2 | ||
)}`} | ||
</Pre> | ||
); | ||
}; | ||
|
||
export default DefaultVariablesValuesRenderer; |
Oops, something went wrong.