Skip to content

Commit

Permalink
Merge pull request #199 from InternAcademy/dev
Browse files Browse the repository at this point in the history
Merge dev into prod
  • Loading branch information
ImSk1 authored Aug 19, 2024
2 parents 5fa4f0e + 1a9c0c6 commit f339729
Show file tree
Hide file tree
Showing 96 changed files with 3,123 additions and 881 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -405,4 +405,5 @@ src/server/CookingApp/Properties/launchSettings.json
.prettierrc
.prettierignore
src/server/CookingApp/Properties/launchSettings.json
/src/server/CookingApp
/src/server/CookingApp/appsettings.Development.json
/src/server/CookingApp/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ const Subscription = () => {
</View>
<View style={tw`w-full items-start px-6`}>
<Text
style={tw`text-2xl font-bold mb-4 ${isDarkTheme ? "text-white" : "text-black"}`}
style={tw`text-2xl font-bold mb-4 ${isDarkTheme ? "text-white" : "primaryText"}`}
>
Heading for FAQs
</Text>
Expand Down
54 changes: 27 additions & 27 deletions src/client/CookingAppReact/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/client/CookingAppReact/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@vitejs/plugin-react": "^4.3.1",
"autoprefixer": "^10.4.19",
"autoprefixer": "^10.4.20",
"eslint": "^8.57.0",
"eslint-plugin-react": "^7.34.3",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-react-refresh": "^0.4.7",
"postcss": "^8.4.40",
"tailwindcss": "^3.4.7",
"postcss": "^8.4.41",
"tailwindcss": "^3.4.10",
"vite": "^5.3.4"
}
}
42 changes: 36 additions & 6 deletions src/client/CookingAppReact/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ import Chat from "./pages/chat/Chat";
import Layout from "./pages/layout/Layout";
import Recipe from "./pages/recipe/Recipe";
import Admin from "./pages/admin/Admin";
import Subscribtion from "./pages/subscribtion/Subscribtion";
import Subscribtion from "./pages/subscribtion/Subscription";
import Success from "./pages/subscribtion/Succes";
import Settings from "./components/userMenu/settings/Settings";
import SubscribtionDetails from "./pages/subscribtion/SubscribtionDetails";
import Settings from "./pages/settings/Settings";
import SubscriptionDetails from "./pages/subscribtion/SubscriptionDetails";
import Rules from "./pages/rules/Rules";
import NotFound from "./pages/error/NotFound";
import AuthorizeRoute from "./pages/authorize/AuthorizeRoute";
const router = createBrowserRouter([
{
path: "/",
Expand All @@ -26,11 +28,39 @@ const router = createBrowserRouter([
],
},
{ path: "r/:recipeId", element: <Recipe /> },
{ path: "admin/dashboard", element: <Admin /> },
{ path: "subscription", element: <Subscribtion /> },
{ path: "subscription/manage", element: <SubscribtionDetails /> },
{
path: "admin/dashboard",
element: (
<AuthorizeRoute
succesPage={<Admin />}
requiredRole={"Admin"}
unAuthorizedPath={"/"}
/>
),
},
{
path: "subscription",
element: (
<AuthorizeRoute
succesPage={<Subscribtion />}
requiredRole={"Free"}
unAuthorizedPath={"/"}
/>
),
},
{
path: "subscription/manage",
element: (
<AuthorizeRoute
succesPage={<SubscriptionDetails />}
requiredRole={"Premium"}
unAuthorizedPath={"/"}
/>
),
},
{ path: "success", element: <Success /> },
{ path: "settings", element: <Settings /> },
{ path: "/rules-and-policies", element: <Rules /> },
],
errorElement: <NotFound />,
},
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
18 changes: 10 additions & 8 deletions src/client/CookingAppReact/src/components/chat/BotResponse.jsx
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 @@ -29,23 +29,25 @@ export default function BotResponse({ message }) {
width={40}
className="border shadow-sm rounded-full p-1 mr-5"
/>
<p className="whitespace-pre-wrap">{message.content}</p>
<p className="whitespace-pre-wrap text-primaryText">
{message.content}
</p>
</div>
{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-orange-200 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>
<span className="text-primaryText">
Crafting Meal
<span className="dot-1">.</span>
<span className="dot-2">.</span>
Expand All @@ -60,7 +62,7 @@ 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-orange-200 font-semibold cursor-pointer
className={`w-fit flex flex-row border-2 px-4 py-2 rounded-full bg-primary font-semibold cursor-pointer
${
isPending
? "border-dance animate-border-dance"
Expand All @@ -70,7 +72,7 @@ export default function BotResponse({ message }) {
onClick={handleFreeUser}
>
<SparklesIcon className="size-6 opacity-70 mr-2" />
<p>Get Premium</p>
<p className="text-primaryText">Get Premium</p>
</div>
</div>
)}
Expand Down
16 changes: 10 additions & 6 deletions src/client/CookingAppReact/src/components/chat/ChatInput.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ export default function ChatInput() {
const input = useSelector((state) => state.ui.input);
const fileAttacher = useRef();
const selectedChat = useSelector((state) => state.user.selectedChat);
const isInitial = useSelector((state) => state.ui.isMessageWarningShowed);
const role = useSelector((state) => state.user.role);
const { mutate, isPending, error, isError } = useChat();
const dispatch = useDispatch();
const [base64Image, setBase64Image] = useState(null);
useEffect(() => {
if (role.limitations.chatGeneration === 10) {
if (role.limitations.chatGeneration === 10 && !isInitial) {
toast(
(t) => (
<span>
Expand All @@ -27,6 +28,7 @@ export default function ChatInput() {
),
{ position: "bottom-right" }
);
dispatch(uiActions.setIsShown(true));
}
}, [role.limitations.chatGeneration]);

Expand Down Expand Up @@ -66,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 @@ -98,13 +99,12 @@ export default function ChatInput() {
});
}
sendMessage();
console.log(base64Image);
}
}, [base64Image]);

return (
<section className="flex items-center justify-center mb-5 w-full">
<ul className="flex w-4/5 md:w-3/5 lg:w-2/5 items-center bg-gray-200 rounded-full gap-2 py-2 px-4">
<section className="flex flex-col items-center justify-center mb-5 w-full gap-1 ">
<ul className="flex w-4/5 md:w-3/5 lg:w-2/5 items-center secondary rounded-full gap-2 py-2 px-4 bg-active text-primaryText">
<li>
<input
type="file"
Expand All @@ -125,7 +125,7 @@ export default function ChatInput() {
placeholder="What do you want to cook today?"
onKeyDown={handleChange}
onChange={handleChange}
className="w-full outline-none bg-gray-200 text-black placeholder-black"
className="w-full outline-none bg-active text-primaryText"
/>
</li>
<li>
Expand All @@ -137,6 +137,10 @@ export default function ChatInput() {
/>
</li>
</ul>
<p className="hidden md:inline text-sm opacity-80 text-primaryText">
Meal Master may occasionally make mistakes. Please verify any important
information.
</p>
</section>
);
}
Loading

0 comments on commit f339729

Please sign in to comment.