Skip to content

Commit

Permalink
fixed image sizes and massive bug overhaul
Browse files Browse the repository at this point in the history
  • Loading branch information
r-southworth committed Sep 4, 2024
1 parent a113c89 commit 84f2476
Show file tree
Hide file tree
Showing 31 changed files with 494 additions and 915 deletions.
1 change: 1 addition & 0 deletions src/components/common/HeaderSearchBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export const SearchBar: Component = () => {
searchString() !== "null"
) {
localStorage.setItem("searchString", searchString());
console.log("Set Search to Local Storage", searchString());
}

// console.log(window.location.href)
Expand Down
4 changes: 3 additions & 1 deletion src/components/common/cart/CartCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ export const CartCard: Component<Props> = (props) => {
const [newItems, setNewItems] = createSignal<Array<Post>>([]);
const [quantity, setQuantity] = createSignal<number>(0);

console.log(items);

createEffect(async () => {
if (props.items) {
// const updatedItems = await Promise.all(
Expand Down Expand Up @@ -133,7 +135,7 @@ export const CartCard: Component<Props> = (props) => {
? "User Image"
: "No image"
}
class="h-full w-full rounded-lg bg-background1 object-cover dark:bg-icon1-DM"
class="h-48 w-48 rounded-lg bg-background1 object-cover dark:bg-icon1-DM"
loading="lazy"
onload={(e) => {
lazyLoadImage(
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/cart/CartCardDonate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const CartCardDonate: Component<Props> = (props) => {
src={LearnGroveCommunity.src}
// TODO Internationalize
alt="Build Your LearnGrove"
class="h-full w-full rounded-lg bg-background1 object-cover dark:bg-icon1-DM"
class="h-44 w-44 rounded-lg bg-background1 object-cover dark:bg-icon1-DM"
/>
</div>

Expand Down
2 changes: 1 addition & 1 deletion src/components/common/cart/CartCardDonateMobile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const CartCardDonateMobile: Component<Props> = (props) => {
src={LearnGroveCommunity.src}
// TODO Internationalize
alt="Build Your LearnGrove"
class="h-full w-full rounded-lg bg-background1 object-cover dark:bg-icon1-DM"
class="h-22 w-22 rounded-lg bg-background1 object-cover dark:bg-icon1-DM"
/>
</div>

Expand Down
2 changes: 1 addition & 1 deletion src/components/common/cart/CartCardMobile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export const CartCardMobile: Component<Props> = (props) => {
? "User Image"
: "No image"
}
class="h-full w-full rounded-lg bg-background1 object-cover dark:bg-icon1-DM"
class="h-22 w-22 rounded-lg bg-background1 object-cover dark:bg-icon1-DM"
loading="lazy"
onload={(e) => {
lazyLoadImage(
Expand Down
2 changes: 0 additions & 2 deletions src/components/common/cart/ViewCart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ const t = useTranslations(lang);

export const CartView = () => {
const [totalItems, setTotalItems] = createSignal(0);
const [itemsDetails, setItemsDetails] = createSignal<Post[]>([]);
const [cartTotal, setCartTotal] = createSignal(0);
const [donation, setDonation] = createSignal(0);
const screenSize = useStore(windowSize);
Expand Down Expand Up @@ -75,7 +74,6 @@ export const CartView = () => {
let total = 0;
{
console.log("items in cart: " + items.length);
console.log("Item Details: " + itemsDetails());
}
items.forEach((item: Post) => {
if (item.price) {
Expand Down
7 changes: 1 addition & 6 deletions src/components/members/CreatorProfileView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import { getLangFromUrl, useTranslations } from "../../i18n/utils";
import { createStore } from "solid-js/store";
import { StripeButton } from "@components/members/creator/StripeButton";
import { PayoutButton } from "@components/members/creator/PayoutButton";
import { MobileViewCard } from "@components/services/MobileViewCard";
import type { Creator } from "@lib/types";
import { TinyComp } from "@components/posts/TinyComp";
import {
Expand Down Expand Up @@ -85,10 +84,6 @@ export const CreatorProfileView: Component = () => {
}
});

createEffect(() => {
console.log("creatorImage value:", creatorImage());
});

const resetPassword = () => {
window.location.href = `/${lang}/password/reset`;
};
Expand Down Expand Up @@ -330,7 +325,7 @@ export const CreatorProfileView: Component = () => {
<img
src={person.src}
data-src={creatorImage().jpegUrl}
class="absolute left-1/2 top-1/2 block h-56 -translate-x-1/2 -translate-y-1/2 justify-center object-contain md:h-96"
class="absolute left-1/2 top-1/2 block h-[142px] w-[142px] -translate-x-1/2 -translate-y-1/2 justify-center object-contain"
alt={`${t("postLabels.creatorProfileImage")} 1`}
loading="lazy"
/>
Expand Down
2 changes: 1 addition & 1 deletion src/components/members/UserCreatorView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ export const UserCreatorView: Component<Props> = (props) => {
<img
src={creatorImage().jpegUrl}
alt={`${t("postLabels.CreatorProfileImage")} 1`}
class="absolute left-12 top-6 flex h-36 w-36 items-center justify-center rounded-full border-2 border-gray-400 bg-background2 object-contain dark:bg-background2-DM"
class="absolute left-12 top-6 flex h-[142px] w-[142px] items-center justify-center rounded-full border-2 border-gray-400 bg-background2 object-contain dark:bg-background2-DM"
/>
</picture>
</div>
Expand Down
10 changes: 0 additions & 10 deletions src/components/members/UserProfileView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,10 @@ import {
} from "solid-js";
import supabase from "../../lib/supabaseClient";
import type { AuthSession } from "@supabase/supabase-js";
import UserImage from "./UserImage";
import { ui } from "../../i18n/ui";
import type { uiObject } from "../../i18n/uiType";
import { getLangFromUrl, useTranslations } from "../../i18n/utils";
import type { User } from "@lib/types";
import type { Post } from "@lib/types";
import { ViewCard } from "@components/services/ViewCard";
import { ViewUserPurchases } from "@components/posts/ViewUserPurchases";
import stripe from "@lib/stripe";
import { UserProfileViewMobile } from "@components/members/UserProfileViewMobile";
import { useStore } from "@nanostores/solid";
import { windowSize } from "@components/common/WindowSizeStore";
Expand All @@ -27,10 +22,6 @@ import { ViewUserFavorites } from "@components/posts/ViewUserFavorites";
const lang = getLangFromUrl(new URL(window.location.href));
const t = useTranslations(lang);

//get the categories from the language files so they translate with changes in the language picker
const values = ui[lang] as uiObject;
const productCategories = values.subjectCategoryInfo.subjects;

async function postFormData(formData: FormData) {
const response = await fetch("/api/userProfileEdit", {
method: "POST",
Expand Down Expand Up @@ -60,7 +51,6 @@ export const UserProfileView: Component = () => {
const screenSize = useStore(windowSize);
const [formData, setFormData] = createSignal<FormData>();
const [response] = createResource(formData, postFormData);
const [purchasedItems, setPurchasedItems] = createSignal<Array<Post>>([]);
const [tabSelected, setTabSelected] = createSignal<string>("purchases");

onMount(async () => {
Expand Down
36 changes: 0 additions & 36 deletions src/components/members/UserProfileViewMobile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,45 +9,15 @@ import {
Suspense,
} from "solid-js";
import supabase from "../../lib/supabaseClient";
import type { AuthSession } from "@supabase/supabase-js";
import UserImage from "./UserImage";
import { ui } from "../../i18n/ui";
import type { uiObject } from "../../i18n/uiType";
import { getLangFromUrl, useTranslations } from "../../i18n/utils";
import type { User } from "@lib/types";
import type { Post } from "@lib/types";
import { ViewCard } from "@components/services/ViewCard";
import stripe from "@lib/stripe";
import { ViewUserPurchases } from "@components/posts/ViewUserPurchases";
import { ViewUserFavorites } from "@components/posts/ViewUserFavorites";

const lang = getLangFromUrl(new URL(window.location.href));
const t = useTranslations(lang);

//get the categories from the language files so they translate with changes in the language picker
const values = ui[lang] as uiObject;
const productCategories = values.subjectCategoryInfo.subjects;

async function postFormData(formData: FormData) {
const response = await fetch("/api/userProfileEdit", {
method: "POST",
body: formData,
});
const data = await response.json();
//Checks the API response for the redirect and sends them to the redirect page if there is one
if (data.redirect) {
alert(data.message);
window.location.href = `/${lang}` + data.redirect;
}
return data;
}

const { data: User, error: UserError } = await supabase.auth.getSession();

if (UserError) {
console.log("UserError: ", UserError.code + " " + UserError.message);
}

interface Props {
user: User | null;
userImage: string | undefined;
Expand All @@ -56,12 +26,6 @@ interface Props {
}

export const UserProfileViewMobile: Component<Props> = (props: Props) => {
// const [user, setUser] = createSignal<User>();
// const [session, setSession] = createSignal<AuthSession | null>(null);
// const [userImage, setUserImage] = createSignal<string>();
// const [editMode, setEditMode] = createSignal<boolean>(false); //TODO Set back to false
const [imageUrl, setImageUrl] = createSignal<string | null>(null);
const [purchasedItems, setPurchasedItems] = createSignal<Array<Post>>([]);
const [tabSelected, setTabSelected] = createSignal<string>("purchases");

const resetPassword = () => {
Expand Down
4 changes: 2 additions & 2 deletions src/components/members/user/DownloadBtn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ export const DownloadBtn: Component<Props> = (props: Props) => {
return;
}
setPurchasedItems(productsInfo);
// console.log("Purchased Items");
// console.log(purchasedItems());
console.log("Purchased Items");
console.log(purchasedItems());

// console.log("Checking purchased items");

Expand Down
2 changes: 1 addition & 1 deletion src/components/posts/EditPost.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1059,7 +1059,7 @@ export const EditPost: Component<Props> = (props: Props) => {
</div>

{/* Price Implementation */}
{/* <div class="justfify-evenly mt-6 flex flex-col ">
{/* <div class="justify-evenly mt-6 flex flex-col ">
<div class="mt-2 flex justify-between">
<p>{t("formLabels.isResourceFree")}?</p>
<div>
Expand Down
Loading

0 comments on commit 84f2476

Please sign in to comment.