working typescript version

This commit is contained in:
erik-sn committed 2020-10-07 12:19:55 -04:00
1 parent 581d6011e0
commit cff746aa38
119 files changed
+247 -189

No files matched your search

-31
View File
@@ -1,31 +0,0 @@
import { useRecoilState, atom } from 'recoil';
const transactionListState = atom({
key: 'transactionList',
default: [
{
id: 0,
amount: 300,
type: 'withdraw',
date: '3'
},
{
id: 1,
amount: 1000,
type: 'withdraw',
date: '3'
},
{
id: 2,
amount: 50,
type: 'transfer',
date: '2'
},
],
});
export const useBank = () => {
const [transactionList, setTransactionList] = useRecoilState
(transactionListState);
return { transactionList, setTransactionList };
}
+32
View File
@@ -0,0 +1,32 @@
import { useRecoilState, atom } from "recoil";
const transactionListState = atom({
key: "transactionList",
default: [
{
id: 0,
amount: 300,
type: "withdraw",
date: "3",
},
{
id: 1,
amount: 1000,
type: "withdraw",
date: "3",
},
{
id: 2,
amount: 50,
type: "transfer",
date: "2",
},
],
});
export const useBank = () => {
const [transactionList, setTransactionList] = useRecoilState(
transactionListState
);
return { transactionList, setTransactionList };
};
File renamed without changes.
@@ -127,7 +127,7 @@ export const AddTweetModal = () => {
withValidImage(cleanedLink, () => setImages([...images, image]));
setShowImagePrompt(false);
setLink('')
setLink("");
};
const removeImage = (id) =>
setImages(images.filter((image) => id !== image.id));
@@ -171,7 +171,11 @@ export const AddTweetModal = () => {
/>
<div className={classes.buttonsContainer}>
<IconButtons
onImageClick={images.length < config.twitter.maxImages ? toggleShowImagePrompt : null}
onImageClick={
images.length < config.twitter.maxImages
? toggleShowImagePrompt
: null
}
onEmojiClick={toggleShowEmoji}
/>
<ControlButtons
@@ -21,18 +21,22 @@ const useStyles = makeStyles((theme) => ({
export const IconButtons = ({ onImageClick, onEmojiClick }) => {
const classes = useStyles();
const { config } = usePhone();
if (!config) return null;
const { enableImages, enableEmojis } = config.twitter;
return (
<div className={classes.buttons}>
{enableImages && (<Button className={classes.button} onClick={onImageClick}>
<InsertPhotoIcon color="action" />
</Button>)}
{enableEmojis && (<Button className={classes.button} onClick={onEmojiClick}>
<EmojiIcon color="action" />
</Button>)}
{enableImages && (
<Button className={classes.button} onClick={onImageClick}>
<InsertPhotoIcon color="action" />
</Button>
)}
{enableEmojis && (
<Button className={classes.button} onClick={onEmojiClick}>
<EmojiIcon color="action" />
</Button>
)}
</div>
);
};
@@ -27,7 +27,6 @@ export function Profile() {
const { profile } = useProfile();
const { config } = usePhone();
// note that this assumes we are defensively checking
// that profile is not null in a parent above this component.
// Annoyingling adding conditionals above this line to not render
@@ -50,7 +49,7 @@ export function Profile() {
Nui.send("phone:updateTwitterProfile", data);
};
// fetching the config is an asynchronous call so defend against it
// fetching the config is an asynchronous call so defend against it
if (!config) return null;
const { enableAvatars, allowEdtiableProfileName } = config.twitter;
@@ -23,8 +23,11 @@ export const TweetMessage = ({ message, handleChange }) => {
const { config } = usePhone();
const { t } = useTranslation();
const overCharacterLimit = message.trim().length > config.twitter.characterLimit;
const characterWarningPrompt = `${t("APPS_TWITTER_TWEET_MESSAGE_CHAR_LIMIT")} (${config.twitter.characterLimit})`;
const overCharacterLimit =
message.trim().length > config.twitter.characterLimit;
const characterWarningPrompt = `${t(
"APPS_TWITTER_TWEET_MESSAGE_CHAR_LIMIT"
)} (${config.twitter.characterLimit})`;
return (
<TextField
File renamed without changes.
@@ -12,7 +12,10 @@ const DAYS = "APPS_TWITTER_TIME_DAYS";
* @param {function} t - translation object passed from a component implementing the hook
* @param {number} seconds - seconds to translate to a string
*/
export function secondsToHumanReadable(t, seconds) {
export function secondsToHumanReadable(
t: (input: string) => string,
seconds: number
): string {
if (seconds < 60) {
return t(JUST_NOW);
} else if (seconds < ONE_HOUR) {