diff --git a/packages/backend/src/handlers/actions/routes.ts b/packages/backend/src/handlers/actions/routes.ts index a8205e9c..0a2c0b4d 100644 --- a/packages/backend/src/handlers/actions/routes.ts +++ b/packages/backend/src/handlers/actions/routes.ts @@ -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); diff --git a/packages/backend/src/handlers/actions/storage/handler.ts b/packages/backend/src/handlers/actions/storage/handler.ts index 66c097d9..c296e9b9 100644 --- a/packages/backend/src/handlers/actions/storage/handler.ts +++ b/packages/backend/src/handlers/actions/storage/handler.ts @@ -12,9 +12,9 @@ export default async (req: Request, res: Response): Promise => { 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); diff --git a/packages/design-system/.eslintrc.json b/packages/design-system/.eslintrc.json new file mode 100644 index 00000000..30ad2b53 --- /dev/null +++ b/packages/design-system/.eslintrc.json @@ -0,0 +1,10 @@ +{ + "overrides": [ + { + "files": ["./src/**/*.{ts,tsx,js,jsx}", "./stories/**/*.{ts,tsx,js,jsx}"], + "rules": { + "no-console": "off" + } + } + ] +} diff --git a/packages/web/components/Dashboard/LatestContentTabs/Listen.tsx b/packages/web/components/Dashboard/LatestContentTabs/Listen.tsx index cb67769c..26b16e9b 100644 --- a/packages/web/components/Dashboard/LatestContentTabs/Listen.tsx +++ b/packages/web/components/Dashboard/LatestContentTabs/Listen.tsx @@ -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); } diff --git a/packages/web/components/Dashboard/LatestContentTabs/Watch.tsx b/packages/web/components/Dashboard/LatestContentTabs/Watch.tsx index f3acec30..88427ca4 100644 --- a/packages/web/components/Dashboard/LatestContentTabs/Watch.tsx +++ b/packages/web/components/Dashboard/LatestContentTabs/Watch.tsx @@ -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, diff --git a/packages/web/components/WYSIWYGEditor.tsx b/packages/web/components/WYSIWYGEditor.tsx index 431ec987..9f1788d0 100644 --- a/packages/web/components/WYSIWYGEditor.tsx +++ b/packages/web/components/WYSIWYGEditor.tsx @@ -12,7 +12,7 @@ const Editor = dynamic( type Props = { editorState: EditorState; - onEditorStateChange: any; + onEditorStateChange: (state: EditorState) => void; }; export const WYSIWYGEditor: React.FC = ({ diff --git a/packages/web/pages/player/[username].tsx b/packages/web/pages/player/[username].tsx index ce79699b..90e83aff 100644 --- a/packages/web/pages/player/[username].tsx +++ b/packages/web/pages/player/[username].tsx @@ -148,22 +148,27 @@ type ProfileLayoutData = { layouts: Layouts; }; -export const Grid: React.FC = ({ player }): ReactElement => { +export const Grid: React.FC = ({ 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 = ({ 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 = ({ player }): ReactElement => { setCurrentLayoutData, ] = useState(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);