Skip to content

Instantly share code, notes, and snippets.

@arminyahya
arminyahya / a-part-of-edms-appStore.tsx
Last active February 22, 2020 06:36
This is some lines of project appStore
import { AccessActions, SettingEnum } from '../../Enums';
import { getWord, Y } from '../../Language';
import { action, autorun, computed, observable, toJS } from 'mobx';
import { AsyncDataStatus } from '../types';
import { setAppStore, getApiResult, BaseAppStore } from 'yeganeh-common';
import { getAcrhiveCenterData, getUserArchiveCenter, convertArchiveCenterData } from './actions';
import { EdmsAppStoreLoginInfoModel, EdmsLocalStorageData, CommonLocalStorageData, ThemeModel } from './types';
import { defaultAppStoreLoginInfo, langCodes, LangCodeValue, CommonLocalStorageKeys, EdmsLocalStorageKeys, EdmsLocalStorageVersion, CommonLocalStorageVersion } from './values';
import { numericValidator } from '../validators';
import { redirectIfNeeded } from '../utilities';
@arminyahya
arminyahya / a-part-of-document-context.tsx
Created February 22, 2020 05:08
This is shape of DocumentListContext
export class DocumentStore {
referralStore: ReferralStore;
@observable expandedDocumentId: number;
documentListType: number;
resetList?: () => void;
@observable readedDocumentsId: number[] = [];
@observable readedReferredId: number[] = [];
@observable documentsWithNewNote: number[] = [];
@observable newDeletedDocumentNote: number[] = [];
@observable confirmingDocument: boolean;
import getApiResult from 'ProjectGlobals/getApiResult';
type MultiIdentifierPrintModel = Yeganeh.EDMS.WebApi.Models.Document.MultiIdentifierPrintModel<number>;
type ExceptionListPrintModel = Yeganeh.EDMS.WebApi.Models.Document.ExceptionListPrintModel<number>;
type ExceptionAdvancedSearchPrintModel = Yeganeh.EDMS.WebApi.Models.Document.ExceptionAdvancedSearchPrintModel;
export const downloadDocumentAttachments = (dataSent: MultiIdentifierPrintModel) => {
return getApiResult.delete<string>(['Document', 'PrintDocuments'], dataSent);
};
@arminyahya
arminyahya / document-list-float-button.tsx
Last active February 22, 2020 05:04
This is like mobile action-button
import React, { useState, useContext, useMemo } from 'react';
import styled from '@emotion/styled';
import { DocumentSelectionIcon, Approve, Reject, ArchiveIcon, RestoreIcon } from 'Icons';
import { ReferralIcon, getWord, DocumentListType } from 'edms-common';
import { Icons } from 'yeganeh-common';
import DocumentListContext from 'Document/DocumentList/DocumentListContext';
import { observer } from 'mobx-react';
import { getDashboardUrlInfo } from 'Document/DocumentList/Dashboard/utilities';
import { RouteComponentProps, withRouter } from 'react-router';
import { routeNames } from 'Routes';
@arminyahya
arminyahya / float-maker-hoc.tsx
Last active February 24, 2020 17:24
This hoc wrap is used to add a float lable to form input
import * as React from 'react';
import { Omit, removeKeys } from '../utilities';
export interface Props {
label: string | React.Component;
value?: any;
error?: string;
onChange: (newValue?: any) => void;
isRequired?: boolean;
focused?: boolean;
import React from 'react';
import { Query } from 'react-apollo';
import ScreenFocusHook from './screenFocusHook';
const ProductQuery = (props) => {
const navigation = props.navigation;
const getProductsQuery = /* your grahql query here */
const [setCallBack] = ScreenFocusHook(navigation);
return (<Query query={getProductsQuery} notifyOnNetworkStatusChange>
import { useEffect, useRef } from 'react';
const ScreenFocusHook = (navigation) => {
const _didFocusSubscription = useRef();
const callBack = useRef();
useEffect(() => {
_didFocusSubscription.current = navigation.addListener(
'didFocus',
payload => {
console.log('focus');
var express = require('express');
var express_graphql = require('express-graphql');
var { schema, root} = require('./schema');
var isAuth = require('./middleware/is-auth');
var app = express();
app.use(isAuth)
app.use('/graphql', express_graphql({
schema: schema,
rootValue: root,
var express = require('express');
var express_graphql = require('express-graphql');
var { schema, root} = require('./schema');
var app = express();
app.use('/graphql', express_graphql({
schema: schema,
rootValue: root,
graphiql: true
}));
var { buildSchema } = require('graphql');
var { MoviesList } = require('./movie-list');
var schema = buildSchema(`
type Query {
movieInfo(id: Int!): Movie
movieList(rate: String): [Movie]
},
type Movie {
id: Int