Skip to content

Commit

Permalink
Remove console logs, and dark theme changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dpS1lence committed Aug 19, 2024
1 parent 6bffffd commit 69e6bd7
Show file tree
Hide file tree
Showing 29 changed files with 89 additions and 71 deletions.
4 changes: 2 additions & 2 deletions src/client/CookingAppReact/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Admin from "./pages/admin/Admin";
import Subscribtion from "./pages/subscribtion/Subscription";
import Success from "./pages/subscribtion/Succes";
import Settings from "./pages/settings/Settings";
import SubscribtionDetails from "./pages/subscribtion/SubscribtionDetails";
import SubscriptionDetails from "./pages/subscribtion/SubscriptionDetails";
import Rules from "./pages/rules/Rules";
import NotFound from "./pages/error/NotFound";
import AuthorizeRoute from "./pages/authorize/AuthorizeRoute";
Expand Down Expand Up @@ -52,7 +52,7 @@ const router = createBrowserRouter([
path: "subscription/manage",
element: (
<AuthorizeRoute
succesPage={<SubscribtionDetails />}
succesPage={<SubscriptionDetails />}
requiredRole={"Premium"}
unAuthorizedPath={"/"}
/>
Expand Down
14 changes: 5 additions & 9 deletions src/client/CookingAppReact/src/components/auth/SignOutButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,14 @@ const SignOutButton = () => {
<button className="flex items-center" title="Sign Out" onClick={() => handleLogout("redirect")}>
<ArrowRightStartOnRectangleIcon
className="w-6 h-6 mr-4
smallPhone:w-4
phone:w-4
tablet:w-6
web:w-6"
sm:w-4
md:w-4
lg:w-6
xl:w-6"
// color={isDarkTheme ? "white" : "black"}
/>
<span
className={`
smallPhone:text-base
phone:text-base
tablet:text-lg
web:text-lg`}>Sign Out</span>
className={`text-primaryText`}>Sign Out</span>
</button>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default function BotResponse({ message }) {
navigate("/subscription");
}
return (
<li className="w-4/5" key={message.content}>
<li className="w-4/5 text-primaryText" key={message.content}>
<div className="flex flex-col justify-start items-start gap-1">
<div className="flex flex-row items-start">
<img
Expand All @@ -36,16 +36,16 @@ export default function BotResponse({ message }) {
{message.type === "Recipe" && role !== "Free" && (
<div className="w-full flex justify-center content-center items-center my-5">
<div
className={`w-fit flex flex-row border-2 px-4 py-2 rounded-full bg-primary font-semibold cursor-pointer
className={`w-fit flex flex-row border px-4 py-2 rounded-full bg-primary font-semibold cursor-pointer
${
isPending
? "border-dance animate-border-dance"
: "hover:border-orange-200 hover:scale-105 transition-transform duration-300"
: "hover:scale-105 transition-transform duration-300"
}
relative ${isPending && "sparkle"}`}
onClick={handleClick}
>
<SparklesIcon className="size-6 opacity-70 mr-2" />
<SparklesIcon className="size-6 opacity-70 mr-2 text-primaryText" />
{isPending ? (
<span className="text-primaryText">
Crafting Meal
Expand Down
5 changes: 1 addition & 4 deletions src/client/CookingAppReact/src/components/chat/ChatInput.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export default function ChatInput() {
const [base64Image, setBase64Image] = useState(null);
useEffect(() => {
if (role.limitations.chatGeneration === 10 && !isInitial) {
console.log(isInitial);
toast(
(t) => (
<span>
Expand Down Expand Up @@ -69,7 +68,6 @@ export default function ChatInput() {
}
function handleImageAttachment(event) {
const file = event.target.files[0];
console.log(file);

if (file) {
const reader = new FileReader();
Expand Down Expand Up @@ -101,7 +99,6 @@ export default function ChatInput() {
});
}
sendMessage();
console.log(base64Image);
}
}, [base64Image]);

Expand Down Expand Up @@ -141,7 +138,7 @@ export default function ChatInput() {
</li>
</ul>
<p className="hidden md:inline text-sm opacity-80 text-primaryText">
This AI may occasionally make mistakes. Please verify any important
Meal Master may occasionally make mistakes. Please verify any important
information.
</p>
</section>
Expand Down
3 changes: 2 additions & 1 deletion src/client/CookingAppReact/src/components/navbar/Navbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ export default function Navbar() {
dispatch(uiActions.toggleRecipes());
}
function handleNewChat() {
dispatch(uiActions.clearsecondary());
dispatch(uiActions.clearActive());
dispatch(userActions.emptyChat());

navigate("/");
}
const toggleDropDown = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export default function MyRecipes() {
};
useEffect(() => {
if (isOpen) {
console.log("open");
async function getFirstPageAsync() {
const token = await getToken();
const decoded = jwtDecode(token);
Expand All @@ -58,7 +57,6 @@ export default function MyRecipes() {
});
}
function handleChange(event) {
console.log(event.target.value);
setSearch({ isTyping: true, message: event.target.value });
if (timeoutRef.current) {
clearTimeout(timeoutRef.current);
Expand All @@ -81,7 +79,6 @@ export default function MyRecipes() {
}

return () => {
console.log("clear");
if (timeoutRef.current) {
clearTimeout(timeoutRef.current);
}
Expand All @@ -99,12 +96,12 @@ export default function MyRecipes() {
}`}
>
<ChevronLeftIcon
className="size-10 rounded-xl hover:border hover:border-gray-200 hover:cursor-pointer p-2"
className="size-10 rounded-xl border border-transparent hover:border hover:border-active hover:cursor-pointer p-2"
onClick={handleRecipes}
/>
<h1 className="text-lg text-primaryText">My Recipes</h1>
<UserIcon
className="size-10 invisible md:visible rounded-xl hover:border hover:border-gray-200 hover:cursor-pointer p-2"
className="size-10 invisible md:visible rounded-xl border border-transparent hover:border hover:border-active hover:cursor-pointer p-2"
onClick={(e) => {
e.stopPropagation();
toggleDropDown();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default function DietaryPreferences({
className="w-full flex items-center justify-center mt-4 transition duration-300 ease-in-out"
>
<div className="secondary font-semibold border rounded-full py-2 px-5">
<p className="primaryText text-center text-base font-medium">
<p className="text-primaryText text-center text-base font-medium">
Add Allergen
</p>
</div>
Expand Down Expand Up @@ -98,7 +98,7 @@ export default function DietaryPreferences({
className="w-full flex items-center justify-center mt-4 transition duration-300 ease-in-out"
>
<div className="secondary font-semibold border rounded-full py-2 px-5">
<p className="primaryText text-center text-base font-medium">
<p className="text-primaryText text-center text-base font-medium">
Add Food
</p>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export default function Preferences() {
const [error, setError] = useState("");
const { save, isSaving } = useFoodPreferences();
useEffect(() => {
console.log(dietaryPreferences.dietaryPreference);
setAlergens(dietaryPreferences.allergies);
setFoodPreferences(dietaryPreferences.avoidedFoods);
setSelectedPreference(dietaryPreferences.dietaryPreference);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default function ChatItem({ title, id }) {
className={`rounded-lg h-10 my-5 ${
activeChat && activeChat === id
? "bg-active"
: "hover:secondary bg-transparent"
: "hover:bg-active bg-transparent"
} hover:cursor-pointer flex flex-row justify-between items-center text-center group transition-colors duration-1000"`}
>
<h5 className="px-5 text-primaryText py-2 whitespace-nowrap text-ellipsis overflow-hidden">
Expand Down
6 changes: 2 additions & 4 deletions src/client/CookingAppReact/src/components/sidebar/Sidebar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export default function Sidebar() {
const decoded = jwtDecode(token);
getFirstPage({ token: token, userId: decoded.sub, pageIndex: 1 });
}
console.log(chatHistory);
getFirstPageAsync();
}
}, [isOpen]);
Expand All @@ -51,7 +50,6 @@ export default function Sidebar() {
function handleNewChat() {
dispatch(uiActions.clearActive());
dispatch(userActions.emptyChat());
dispatch(uiActions.closeSidebar());

navigate("/");
}
Expand Down Expand Up @@ -134,7 +132,7 @@ export default function Sidebar() {
className={`${isPremium() || !isOpen ? "hidden" : ""}`}
onClick={handleClickSubscribtion}
>
<h5 className="hover:bg-primary mt-5 rounded-lg m-3 px-5 py-2 flex flex-row justify-start items-center hover:cursor-pointer isolate bg-secondary shadow-sm ring-1 ring-black/5">
<h5 className="hover:bg-active mt-5 rounded-lg m-3 px-5 py-2 flex flex-row justify-start items-center hover:cursor-pointer isolate bg-secondary shadow-sm ring-1 ring-black/5">
<BanknotesIcon className="size-5 mr-5" />
Get Premium
</h5>
Expand All @@ -143,7 +141,7 @@ export default function Sidebar() {
className={`${!isPremium() || !isOpen ? "hidden" : ""}`}
onClick={handleClickYourSubscribtion}
>
<h5 className="hover:bg-gray-300 mt-5 rounded-lg m-3 px-5 py-2 flex flex-row justify-start items-center hover:cursor-pointer isolate bg-secondary shadow-sm ring-1 ring-black/5">
<h5 className="hover:bg-active mt-5 rounded-lg m-3 px-5 py-2 flex flex-row justify-start items-center hover:cursor-pointer isolate bg-secondary shadow-sm ring-1 ring-black/5">
<BanknotesIcon className="size-5 mr-5" />
Your Subscription
</h5>
Expand Down
11 changes: 6 additions & 5 deletions src/client/CookingAppReact/src/components/userMenu/UserMenu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const UserMenu = ({ isOpen, toggleDropDown }) => {
const menuRef = useRef(null);

useEffect(() => {
console.log(isOpen);
function handleClickOutside(event) {
if (menuRef.current && !menuRef.current.contains(event.target)) {
toggleDropDown();
Expand All @@ -40,7 +39,7 @@ const UserMenu = ({ isOpen, toggleDropDown }) => {
onClick={(e) => e.stopPropagation()}
className={`absolute right-2 top-12 w-56
${isDarkTheme ? "bg-[#2F2F2F]" : "bg-secondary"}
border border-secondary rounded-3xl shadow-sm z-20 text-primaryText`}
border rounded-3xl shadow-sm z-20 text-primaryText`}
>
<div className="flex flex-col p-4">
<div className="flex flex-col items-start w-full space-y-2">
Expand Down Expand Up @@ -91,10 +90,12 @@ const UserMenu = ({ isOpen, toggleDropDown }) => {
</div>
</div>
<hr
className={`w-full mt-2 mb-2 border-primaryText
}`}
className={`w-full mt-2 mb-2`}
/>
<div className={`p-2hover:bg-base hover:rounded`}>
<div className={`flex items-center w-full cursor-pointer p-2
${
isDarkTheme ? "hover:bg-[#424242]" : "hover:bg-base"
} hover:rounded`}>
<SignOutButton />
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,6 @@ const FoodPreferences = () => {
};

const handleSavePreferences = async () => {
const preferences = { alergens, foodPreferences, selectedPreference };
console.log("Saving preferences:", preferences);

try {
await new Promise((resolve) => setTimeout(resolve, 1000));

Expand Down
3 changes: 0 additions & 3 deletions src/client/CookingAppReact/src/hooks/useChatHistory.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const useChatHistory = () => {
} = useMutation({
mutationFn: getUserChats,
onMutate: () => {
console.log("hii");
},
onSuccess: (response) => {
dispatch(userActions.firstPageChatHistory(response.data));
Expand All @@ -28,10 +27,8 @@ const useChatHistory = () => {
mutationFn: getUserChats,
onMutate: () => {},
onError: (errr) => {
console.log(errr);
},
onSuccess: (response) => {
console.log("return next page ", response);
dispatch(userActions.setChatHistory(response.data));
},
});
Expand Down
1 change: 0 additions & 1 deletion src/client/CookingAppReact/src/hooks/useFetchUserStatus.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const useFetchUserStatus = () => {
const response = await checkUserStatus({ token });
if (response.status !== 401) {
const body = await response.json();
console.log(body);
dispatch(uiActions.setTheme(body.data.interfacePreference.theme));
dispatch(uiActions.setLanguage(body.data.interfacePreference.language));
dispatch(userActions.setRole(body.data.role));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const useFirstPageRecipes = () => {
mutationFn: getRecipes,
onMutate: () => {},
onError: (errr) => {
console.log(errr);
},
onSuccess: (data) => {
dispatch(uiActions.getFirstPage(data));
Expand Down
1 change: 0 additions & 1 deletion src/client/CookingAppReact/src/hooks/useSaveRecipe.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ const useSaveRecipe = () => {
dispatch(userActions.reduceRecipeGeneration());
},
onSuccess: (response) => {
console.log(response);
dispatch(uiActions.showToast(response));
},
onError: (error) => {
Expand Down
1 change: 0 additions & 1 deletion src/client/CookingAppReact/src/hooks/useStripeSession.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const useStripeSession = () => {
} = useMutation({
mutationFn: createSub,
onSuccess: (response) => {
console.log(response.data.sessionUrl);
window.location.href = response.data.sessionUrl;
},
});
Expand Down
1 change: 0 additions & 1 deletion src/client/CookingAppReact/src/http/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import toast from "react-hot-toast";
const ip = import.meta.env.VITE_PUBLIC_PERSONAL_IP;

export async function sendMessage({ token, chatId, type, content }) {
console.log("sending");
const response = await fetch(`${ip}/message`, {
method: "POST",
headers: {
Expand Down
3 changes: 0 additions & 3 deletions src/client/CookingAppReact/src/http/subs.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export async function fetchSubs(token) {
throw new Error(response.errors);
}
const data = await response.json();
console.log(data);
return data;
}
export async function createSub({ token, email, priceId }) {
Expand All @@ -25,12 +24,10 @@ export async function createSub({ token, email, priceId }) {
priceId: priceId,
}),
});
console.log(response);
if (!response.ok) {
throw new Error(response.errors);
}
const data = await response.json();
console.log(data);
return data;
}
export async function mySub({ token }) {
Expand Down
4 changes: 0 additions & 4 deletions src/client/CookingAppReact/src/http/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export async function setUi({ token, userId, language, theme }) {
return responseBody.data;
}
export async function checkUserStatus({ token }) {
console.log(token);
const response = await fetch(`${ip}/fetch-profile`, {
method: "GET",
headers: {
Expand Down Expand Up @@ -52,11 +51,9 @@ export async function preferences({
}),
});
const responseBody = await response.json();
console.log(responseBody);
return responseBody;
}
export async function setProfilePicture({ token, image }) {
console.log("wehere");
const response = await fetch(`${ip}/upload-pfp`, {
method: "POST",
headers: {
Expand All @@ -66,6 +63,5 @@ export async function setProfilePicture({ token, image }) {
body: `"${image}"`,
});
const responseBody = await response.json();
console.log(responseBody);
return responseBody;
}
2 changes: 1 addition & 1 deletion src/client/CookingAppReact/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
--base: #171717;
--secondary: #212121;
--active: #2f2f2f;
--primary: rgb(254 215 170);
--primary: rgb(101 55 1);
--secondary: #212121;
--primaryText: #ececec;
}
1 change: 0 additions & 1 deletion src/client/CookingAppReact/src/msal/msal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { msalConfig, loginRequest } from "../msal/authConfig";
export const msalInstance = new PublicClientApplication(msalConfig);

export function initializeMsal() {
console.log("=> msal initialization..");
const accounts = msalInstance.getAllAccounts();
if (accounts.length > 0) {
msalInstance.setActiveAccount(accounts[0]);
Expand Down
1 change: 0 additions & 1 deletion src/client/CookingAppReact/src/msal/tokenFetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export async function getCurrentToken(
const accounts = msalInstance.getAllAccounts();

if (accounts.length === 0) {
console.log("No accounts found in MSAL instance.");
return null;
}

Expand Down
Loading

0 comments on commit 69e6bd7

Please sign in to comment.