Skip to content

Commit

Permalink
feat(idea/frontend): sails support (#1576)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitayutanov authored Jul 4, 2024
1 parent 7f96d92 commit e4fdb4b
Show file tree
Hide file tree
Showing 132 changed files with 2,093 additions and 678 deletions.
15 changes: 1 addition & 14 deletions idea/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"react-number-format": "5.3.1",
"react-router-dom": "6.16.0",
"react-transition-group": "4.4.5",
"sails-js": "0.1.5",
"simplebar-react": "3.2.4",
"yup": "1.3.2",
"zod": "3.22.4"
Expand Down Expand Up @@ -70,19 +71,5 @@
"vite-plugin-checker": "0.6.2",
"vite-plugin-node-polyfills": "0.15.0",
"vite-plugin-svgr": "4.1.0"
},
"browserslist": {
"production": [
"chrome >= 67",
"edge >= 79",
"firefox >= 68",
"opera >= 54",
"safari >= 14"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
4 changes: 2 additions & 2 deletions idea/frontend/src/api/message/requests.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { RpcMethods } from '@/shared/config';
import { rpcService } from '@/shared/services/rpcService';
import { IMessage } from '@/entities/message';
import { Message } from '@/features/message';

import { PaginationModel } from '../types';
import { MessagePaginationModel } from './types';
Expand All @@ -9,6 +9,6 @@ const fetchMessages = (params: PaginationModel & { withPrograms?: boolean }) =>
rpcService.callRPC<MessagePaginationModel>(RpcMethods.GetAllMessages, { ...params });

const fetchMessage = (params: { id: string; withMetahash: boolean }) =>
rpcService.callRPC<IMessage>(RpcMethods.GetMessage, params);
rpcService.callRPC<Message>(RpcMethods.GetMessage, params);

export { fetchMessage, fetchMessages };
4 changes: 2 additions & 2 deletions idea/frontend/src/api/message/types.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { HexString } from '@gear-js/api';

import { IMessage } from '@/entities/message';
import { Message } from '@/features/message';

type MessagePaginationModel = {
count: number;
messages: IMessage[];
messages: Message[];
programNames?: Record<HexString, string>;
};

Expand Down
2 changes: 2 additions & 0 deletions idea/frontend/src/app/providers/query/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ const queryClient = new QueryClient({
queries: {
gcTime: 0,
staleTime: Infinity,
refetchOnWindowFocus: false,
retry: false,
},
},
});
Expand Down
2 changes: 1 addition & 1 deletion idea/frontend/src/app/providers/withProviders.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ const providers = [
AccountProvider,
OnboardingProvider,
ChainProvider,
ModalProvider,
EventsProvider,
BlocksProvider,
QueryProvider,
ModalProvider,
];

const withProviders = (Component: ComponentType) => () =>
Expand Down
35 changes: 0 additions & 35 deletions idea/frontend/src/entities/message/helpers/helpers.ts

This file was deleted.

3 changes: 0 additions & 3 deletions idea/frontend/src/entities/message/helpers/index.ts

This file was deleted.

6 changes: 0 additions & 6 deletions idea/frontend/src/entities/message/index.ts

This file was deleted.

27 changes: 0 additions & 27 deletions idea/frontend/src/entities/message/model/consts.ts

This file was deleted.

5 changes: 0 additions & 5 deletions idea/frontend/src/entities/message/model/index.ts

This file was deleted.

22 changes: 0 additions & 22 deletions idea/frontend/src/entities/message/model/types.ts

This file was deleted.

This file was deleted.

This file was deleted.

97 changes: 0 additions & 97 deletions idea/frontend/src/entities/message/ui/messageInfo/MessageInfo.tsx

This file was deleted.

3 changes: 0 additions & 3 deletions idea/frontend/src/entities/message/ui/messageInfo/index.ts

This file was deleted.

4 changes: 3 additions & 1 deletion idea/frontend/src/features/code/hooks/use-wasm-file.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ function useWasmFile(type: WasmFileType = WASM_FILE_TYPE.PROGRAM) {
const { state } = useLocation() as Location;

const [file, setFile] = useState(state?.file);
const [buffer, setBuffer] = useState(state?.buffer);

// browser's history api serizalizes Buffer instance, therefore we need to convert it
const [buffer, setBuffer] = useState(state?.buffer ? Buffer.from(state.buffer) : undefined);

const handleFileChange = useWasmFileHandler(type, (value, bufferValue) => {
setFile(value);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useMemo } from 'react';

import { Fieldset } from '@/shared/ui/fieldset';
import { Fieldset } from '@/shared/ui';

import { PayloadItemProps } from '../../model';
import { getItemLabel, getNextLevelName } from '../../helpers';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Select } from '@gear-js/ui';
import { useFormContext } from 'react-hook-form';

import { useChangeEffect } from '@/hooks';
import { Fieldset } from '@/shared/ui/fieldset';
import { Fieldset } from '@/shared/ui';

import { PayloadItemProps } from '../../model';
import { getItemLabel, getNextLevelName, getPayloadValue } from '../../helpers';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useState, ChangeEvent, useMemo } from 'react';
import { useFormContext } from 'react-hook-form';

import { useChangeEffect } from '@/hooks';
import { Fieldset } from '@/shared/ui/fieldset';
import { Fieldset } from '@/shared/ui';

import { getItemLabel, getPayloadValue } from '../../helpers';
import { PayloadItemProps, OPTION_ITEM_OPTIONS, DEFAULT_OPTION_VALUE } from '../../model';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Fieldset } from '@/shared/ui/fieldset';
import { Fieldset } from '@/shared/ui';

import { PayloadItemProps } from '../../model';
import { getItemLabel, getNextLevelName } from '../../helpers';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Fieldset } from '@/shared/ui/fieldset';
import { Fieldset } from '@/shared/ui';

import { PayloadItemProps } from '../../model';
import { getItemLabel, getNextLevelName } from '../../helpers';
Expand Down
18 changes: 18 additions & 0 deletions idea/frontend/src/features/message/consts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const MESSAGE_TYPE = {
MESSAGE_QUEUED: 'MessageQueued',
USER_MESSAGE_SENT: 'UserMessageSent',
} as const;

const MESSAGE_READ_REASON = {
OUT_OF_RENT: 'OutOfRent',
CLAIMED: 'Claimed',
REPLIED: 'Replied',
} as const;

const MESSAGE_ENTRY_POINT = {
INIT: 'init',
HANDLE: 'handle',
REPLY: 'reply',
} as const;

export { MESSAGE_TYPE, MESSAGE_READ_REASON, MESSAGE_ENTRY_POINT };
Loading

0 comments on commit e4fdb4b

Please sign in to comment.