Skip to content

Commit

Permalink
Merge pull request #229 from InternAcademy/dev
Browse files Browse the repository at this point in the history
UI changes. On site enter redirect.
  • Loading branch information
dpS1lence authored Sep 3, 2024
2 parents 7c965fe + 1c828e1 commit f272e67
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 38 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import LandingPage from "../landingpage/landingpage";
import { useEffect } from 'react';
import { handleLogin } from "../../msal/msal";

export default function UnauthorizedMessage() {
return <LandingPage />;
useEffect(() => {
handleLogin("redirect");
}, []);
}
25 changes: 15 additions & 10 deletions src/client/CookingAppReact/src/components/chat/ChatInput.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default function ChatInput() {
left!
</span>
),
{ position: "bottom-right" }
{ position: "top-center" }
);
dispatch(uiActions.setIsShown(true));
}
Expand Down Expand Up @@ -76,20 +76,25 @@ export default function ChatInput() {
}
function handleImageAttachment(event) {
const file = event.target.files[0];

if (file) {
const validImageTypes = ['image/jpeg', 'image/png', 'image/webp'];
const validImageTypes = ["image/jpeg", "image/png", "image/webp"];

if (!validImageTypes.includes(file.type)) {
toast.error("Please select a valid image file. Supported types: JPEG, PNG, WEBP");
toast.error(
"Please select a valid image file. Supported types: JPEG, PNG, WEBP"
);
return;
}

if (file.size > 8000000) { // 8MB limit
toast.error("Maximum image size exceeded. Please select an image under 8MB.");

if (file.size > 2000000) {
// 2MB limit
toast.error(
"Maximum image size exceeded. Please select an image under 2MB."
);
return;
}

const reader = new FileReader();
reader.onloadend = () => {
setBase64Image(reader.result);
Expand Down Expand Up @@ -168,7 +173,7 @@ export default function ChatInput() {
<li>
<PaperAirplaneIcon
className={`size-10 rounded-xl p-2 duration-200 ${
input.length > 0 ? "bg-orange-300" : ""
input.length > 0 ? "bg-primary" : ""
} cursor-pointer`}
onClick={handleSubmission}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export default function Navbar() {
{role}
</span>
)}
<div className="text-primaryText flex gap-[1px] items-center">
<div className="text-primaryText flex gap-[1px] items-center pr-4">
<p className=" font-bold text-sm">
{limitations.recipeGeneration}
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ export default function DietaryPreferences({
return (
<div className="flex flex-col md:flex-row">
<div className="md:w-1/2 pb-6 m-1 bg-secondary rounded-xl border border-primaryBorder shadow-sm py-4 px-4">
<h2 className="text-lg font-semibold mb-4 primaryText">{t("Allergens")}</h2>
<h2 className="text-lg font-semibold mb-4 primaryText">
{t("Allergens")}
</h2>
{allergens.length > 0 ? (
<div className="flex flex-wrap mb-4">
{allergens.map((alergen, index) => (
Expand All @@ -58,30 +60,30 @@ export default function DietaryPreferences({
) : (
<p className="text-gray-500 text-center mb-4">{t("NoAdded")}</p>
)}
<div className="relative">
<input
type="text"
value={alergenInput}
onChange={handleInputChange}
onClick={() => setIsDropdownOpen(!isDropdownOpen)}
onKeyDown={handleAddAlergenPressEnter}
className="border rounded-lg px-4 py-2 mb-2 w-full border-primaryBorder bg-secondary primaryText"
placeholder={t("AddAllergens")}
/>
{isDropdownOpen && filteredAllergens.length > 0 && (
<ul className="absolute z-10 w-full mt-1 border border-primaryBorder bg-secondary rounded-lg shadow-lg h-36 overflow-y-auto">
{filteredAllergens.map((alergen, index) => (
<li
key={index}
onClick={() => handleDropdownItemClick(alergen)}
className="px-4 py-2 cursor-pointer hover:bg-active"
>
{alergen}
</li>
))}
</ul>
)}
</div>

<input
type="text"
value={alergenInput}
onChange={handleInputChange}
onClick={() => setIsDropdownOpen(!isDropdownOpen)}
onKeyDown={handleAddAlergenPressEnter}
className="border rounded-lg px-4 py-2 mb-2 w-full border-primaryBorder bg-secondary primaryText"
placeholder={t("AddAllergens")}
/>
{isDropdownOpen && filteredAllergens.length > 0 && (
<ul className="z-10 w-full mt-1 border border-primaryBorder bg-secondary rounded-lg shadow-lg h-36 overflow-y-auto">
{filteredAllergens.map((alergen, index) => (
<li
key={index}
onClick={() => handleDropdownItemClick(alergen)}
className="px-4 py-2 cursor-pointer hover:bg-active"
>
{alergen}
</li>
))}
</ul>
)}

{error && <p className="text-red-500 text-center">{error}</p>}
<button
onClick={handleAddAlergen}
Expand Down
2 changes: 1 addition & 1 deletion src/server/CookingApp/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"ASPNETCORE_ENVIRONMENT": "Development"
},
"dotnetRunMessages": true,
"applicationUrl": "http://192.168.0.104:8000"
"applicationUrl": "http://192.168.100.221:8000"
},
"https": {
"commandName": "Project",
Expand Down

0 comments on commit f272e67

Please sign in to comment.