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
const fs = require('fs') | |
const uppercamelcase = require('uppercamelcase') | |
const path = require('path') | |
const prettier = require('prettier') | |
const util = require('@mdi/util') | |
const meta = util.getMeta(true); | |
const rootDir = path.join(__dirname, '..') | |
fs.writeFileSync(path.join(rootDir, 'src', 'index.ts'), '', 'utf-8') |
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
const LmCountrySelector: FC<CountrySelectProps> = ({ | |
options, | |
onChange, | |
onBlur, | |
onFocus, | |
...rest | |
}) => { | |
const mappedOptions = useMemo(() => { | |
return options | |
.map((item) => { |
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
import { RegisterOptions, useController } from 'react-hook-form' | |
import { TextField, TextFieldProps } from '@material-ui/core' | |
import { forwardRef, useEffect, useRef } from 'react' | |
import PhoneInput from 'react-phone-number-input/input-mobile' | |
import useLmTranslation from '../../../lib/hooks/useLmTranslation' | |
type LmTextFieldFormProps = TextFieldProps & { | |
name: `${string}.${string}` | `${string}.${number}` | `${string}` | |
rules?: Exclude< | |
RegisterOptions, |
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
// example usage with useDropzone | |
const FileUpload:FC = ({onUploaded}) => { | |
const [user] = useUser() | |
const [uploadFiles, { error, loading }] = useUploadFiles() | |
const onDrop = useCallback( | |
async (acceptedFiles: File[], rejections?: FileRejection[]) => { | |
if (rejections?.length) { | |
console.error(rejections) | |
} else { |
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
import MUIRichTextEditor from 'mui-rte' | |
import React from 'react' | |
import { stateToHTML } from 'draft-js-export-html' | |
import { TMUIRichTextEditorProps } from 'mui-rte/src/MUIRichTextEditor' | |
type CallbackProps = { | |
data: string | |
html: string | |
text: string | |
editorState: any |
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
const {compile} = require('json-schema-to-typescript') | |
const fs = require('fs') | |
const ComponentsJson = require('./components.XXX') // point to your components.json file | |
const {customTypeParser} = require('./generate-ts-schema-custom-types') // custom components parser for own plugins | |
let tsString = [] | |
async function genTsSchema () { | |
for (const values of ComponentsJson.components) { | |
const obj = {} |
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
/** | |
Adjust SPACE_ID to point to your components.*.json file. | |
Then run the script with `node generate-ts.js` | |
*/ | |
// adjust path to a different location/name | |
const pathToTsFile = 'src/typings/generated/components-schema.d.ts' | |
// adjust space id of the components filename |
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
import Vue from 'vue' | |
import VueApollo from 'vue-apollo' | |
import {createApolloClient, restartWebsockets} from 'vue-cli-plugin-apollo/graphql-client' | |
// Install the vue plugin | |
Vue.use(VueApollo) | |
// Name of the localStorage item | |
const AUTH_TOKEN = 'apollo-token' | |
const IMAP_TOKEN = 'apollo-imap-token' |
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
const fs = require('fs') | |
const tmp = require('tmp') | |
/** | |
* | |
* @param stream | |
* @return {Promise<any>} | |
*/ | |
const storeFS = ({stream}) => { | |
const tmpObj = tmp.fileSync() |
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
Subscription: { | |
user: { | |
subscribe: (parent, args, {pubSub}) => { | |
return pubSub.asyncIterator([MutationTypes.created, MutationTypes.updated]) | |
} | |
} | |
} | |
Mutation: { | |
updateUser: async (parent, {_id, email, firstName, lastName}, {collections, ObjectID, pubSub}) => { |
NewerOlder