mirror of
https://github.com/Mintplex-Labs/anything-llm.git
synced 2024-11-13 10:00:14 +01:00
fcb591d364
* fix sizing of onboarding modals & lint * fix extra scrolling on mobile onboarding flow * added message to use desktop for onboarding * linting * add arrow to scroll to bottom (debounced) and fix chat scrolling to always scroll to very bottom on message history change * fix for empty chat * change mobile alert copy * WIP adding PFP upload support * WIP pfp for users * edit account menu complete with change username/password and upload profile picture * add pfp context to update all instances of usePfp hook on update * linting * add context for logo change to immediately update logo * fix div with bullet points to use list-disc instead * fix: small changes * update multer file storage locations * fix: use STORAGE_DIR for filepathing --------- Co-authored-by: timothycarambat <rambat1010@gmail.com>
31 lines
733 B
JavaScript
31 lines
733 B
JavaScript
import React, { createContext, useState, useEffect } from "react";
|
|
import useUser from "./hooks/useUser";
|
|
import System from "./models/system";
|
|
|
|
export const PfpContext = createContext();
|
|
|
|
export function PfpProvider({ children }) {
|
|
const [pfp, setPfp] = useState(null);
|
|
const { user } = useUser();
|
|
|
|
useEffect(() => {
|
|
async function fetchPfp() {
|
|
if (!user?.id) return;
|
|
try {
|
|
const pfpUrl = await System.fetchPfp(user.id);
|
|
setPfp(pfpUrl);
|
|
} catch (err) {
|
|
setPfp(null);
|
|
console.error("Failed to fetch pfp:", err);
|
|
}
|
|
}
|
|
fetchPfp();
|
|
}, [user?.id]);
|
|
|
|
return (
|
|
<PfpContext.Provider value={{ pfp, setPfp }}>
|
|
{children}
|
|
</PfpContext.Provider>
|
|
);
|
|
}
|