mirror of
https://github.com/MetaFam/TheGame.git
synced 2026-04-24 03:00:09 -04:00
fix: eslint & fetching layout from user on login
This commit is contained in:
committed by
Scott Stevenson
parent
053f4b3266
commit
1f7e5e9a81
@@ -27,8 +27,4 @@ const cpUpload = upload.fields([
|
||||
{ name: 'image', maxCount: 1 },
|
||||
{ name: 'background', maxCount: 1 },
|
||||
]);
|
||||
actionRoutes.post(
|
||||
'/storage',
|
||||
cpUpload,
|
||||
web3StorageUpload,
|
||||
);
|
||||
actionRoutes.post('/storage', cpUpload, web3StorageUpload);
|
||||
|
||||
@@ -12,9 +12,9 @@ export default async (req: Request, res: Response): Promise<Response> => {
|
||||
const files = Object.entries(input).map(([key, [{ path }]]) => ({
|
||||
name: key,
|
||||
stream: () =>
|
||||
fs.createReadStream(
|
||||
(fs.createReadStream(
|
||||
Path.isAbsolute(path) ? path : Path.join(process.cwd(), path),
|
||||
) as any,
|
||||
) as unknown) as ReadableStream,
|
||||
}));
|
||||
|
||||
const cid = await storage.put(files);
|
||||
|
||||
10
packages/design-system/.eslintrc.json
Normal file
10
packages/design-system/.eslintrc.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"overrides": [
|
||||
{
|
||||
"files": ["./src/**/*.{ts,tsx,js,jsx}", "./stories/**/*.{ts,tsx,js,jsx}"],
|
||||
"rules": {
|
||||
"no-console": "off"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -21,7 +21,8 @@ export const Listen: React.FC = () => {
|
||||
const { data, error } = useSWR(podcastRSSURL, parse);
|
||||
|
||||
if (error) {
|
||||
console.error(error);
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('Podcast fetch error: ', error);
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,9 +29,9 @@ export const Watch: React.FC = () => {
|
||||
useEffect(() => {
|
||||
const load = async () => {
|
||||
const res = await fetch(URL).then((r) => r.json());
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const videosList = res.items
|
||||
? res.items.map((video: any) => ({
|
||||
? // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
res.items.map((video: any) => ({
|
||||
id: video.id,
|
||||
videoId: video.snippet.resourceId.videoId,
|
||||
title: video.snippet.title,
|
||||
|
||||
@@ -12,7 +12,7 @@ const Editor = dynamic<EditorProps>(
|
||||
|
||||
type Props = {
|
||||
editorState: EditorState;
|
||||
onEditorStateChange: any;
|
||||
onEditorStateChange: (state: EditorState) => void;
|
||||
};
|
||||
|
||||
export const WYSIWYGEditor: React.FC<Props> = ({
|
||||
|
||||
@@ -148,22 +148,27 @@ type ProfileLayoutData = {
|
||||
layouts: Layouts;
|
||||
};
|
||||
|
||||
export const Grid: React.FC<Props> = ({ player }): ReactElement => {
|
||||
export const Grid: React.FC<Props> = ({ player: initPlayer }): ReactElement => {
|
||||
const [isOwnProfile, setIsOwnProfile] = useState(false);
|
||||
const [, invalidateCache] = useInsertCacheInvalidationMutation();
|
||||
const { user, fetching } = useUser();
|
||||
const { connected } = useWeb3();
|
||||
const [player, setPlayer] = useState(initPlayer);
|
||||
|
||||
useEffect(() => {
|
||||
if (connected && !fetching && user?.id === player?.id) {
|
||||
setIsOwnProfile(true);
|
||||
if (!fetching && user?.player && user?.id === player?.id) {
|
||||
setPlayer(user?.player);
|
||||
if (connected) {
|
||||
setIsOwnProfile(true);
|
||||
}
|
||||
}
|
||||
}, [user, fetching, connected, player?.id]);
|
||||
|
||||
useEffect(() => {
|
||||
if (player) {
|
||||
if (player?.id) {
|
||||
invalidateCache({ playerId: player.id });
|
||||
}
|
||||
}, [player, invalidateCache]);
|
||||
}, [player?.id, invalidateCache]);
|
||||
|
||||
const toast = useToast();
|
||||
|
||||
@@ -173,7 +178,7 @@ export const Grid: React.FC<Props> = ({ player }): ReactElement => {
|
||||
] = useUpdatePlayerProfileLayoutMutation();
|
||||
const [saving, setSaving] = useState(false);
|
||||
|
||||
const layoutsFromDB = player.profile_layout
|
||||
const layoutsFromDB = player?.profile_layout
|
||||
? JSON.parse(player.profile_layout)
|
||||
: null;
|
||||
|
||||
@@ -189,6 +194,17 @@ export const Grid: React.FC<Props> = ({ player }): ReactElement => {
|
||||
setCurrentLayoutData,
|
||||
] = useState<ProfileLayoutData>(savedLayoutData);
|
||||
|
||||
useEffect(() => {
|
||||
const dbLayouts = player?.profile_layout
|
||||
? JSON.parse(player.profile_layout)
|
||||
: null;
|
||||
if (dbLayouts) {
|
||||
setSavedLayoutData(dbLayouts);
|
||||
setCurrentLayoutData(dbLayouts);
|
||||
setEditable(false);
|
||||
}
|
||||
}, [player?.profile_layout]);
|
||||
|
||||
const [changed, setChanged] = useState(false);
|
||||
|
||||
const [editable, setEditable] = useState(false);
|
||||
|
||||
Reference in New Issue
Block a user