Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix #187

Merged
merged 5 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package-lock.json

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

8 changes: 7 additions & 1 deletion src/components/common/MobileProfileBtn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,13 @@ export const MobileProfileBtn = () => {
>
{renderWhenUser()}
<div class="mt-2 border-b-2 border-border1 pb-2 dark:border-border1-DM">
<a href={`/${lang}/faq`}>{t("buttons.faq")}</a>
<a
target="_blank"
rel="noopener noreferrer"
href={`/${lang}/faq`}
>
{t("buttons.faq")}
</a>
</div>
<div class="mt-2">
<div>
Expand Down
8 changes: 7 additions & 1 deletion src/components/common/ProfileBtn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,13 @@ export const ProfileBtn = () => {
>
{renderWhenUser()}
<div class="mt-2 border-b-2 border-border1 pb-2 dark:border-border1-DM">
<a href={`/${lang}/faq`}>{t("buttons.faq")}</a>
<a
target="_blank"
rel="noopener noreferrer"
href={`/${lang}/faq`}
>
{t("buttons.faq")}
</a>
</div>
<div class="mt-2">
<div>
Expand Down
4 changes: 2 additions & 2 deletions src/components/common/notices/Banner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const Banner: Component<BannerProps> = (props) => {
target="_blank"
>
<div class="relative flex w-full bg-btn1 text-center text-btn1Text dark:bg-btn1-DM dark:text-btn1Text-DM">
<div class="prose mx-auto line-clamp-2 max-w-[calc(100vw-4rem)] text-ptext2 dark:text-ptext2-DM">
<div class="prose mx-auto line-clamp-2 max-w-[calc(100vw-4rem)]">
{props.content}
</div>
<button
Expand All @@ -104,7 +104,7 @@ const Banner: Component<BannerProps> = (props) => {
</Show>
<Show when={!props.linkLocation}>
<div class="flex w-full bg-btn1 text-center text-btn1Text dark:bg-btn1-DM dark:text-btn1Text-DM">
<div class="prose mx-auto line-clamp-2 max-w-[calc(100vw-4rem)] text-ptext2 dark:text-ptext2-DM">
<div class="prose mx-auto line-clamp-2 max-w-[calc(100vw-4rem)]">
{props.content}
</div>
<button
Expand Down
2 changes: 1 addition & 1 deletion src/components/members/UserProfileView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ export const UserProfileView: Component = () => {
<Banner
content={
<Modal
buttonClass=""
buttonClass="text-btn1Text dark:text-btn1Text-DM"
buttonId="scavenger2"
buttonContent={t("huntModal.buttonContent")}
buttonAriaLabel={t("huntModal.buttonAria")}
Expand Down
111 changes: 57 additions & 54 deletions src/components/posts/AddFavorite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { getLangFromUrl, useTranslations } from "../../i18n/utils";
import Modal, { closeModal } from "@components/common/notices/modal";
import type { ListData } from "@lib/types";
import { CreateFavoriteList } from "@components/members/user/createFavoriteList";
import { createStore } from "solid-js/store";

const lang = getLangFromUrl(new URL(window.location.href));
const t = useTranslations(lang);
Expand All @@ -18,6 +19,8 @@ interface Props {

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

export const [favoritesLists, setFavoritesLists] = createSignal<ListData[]>([]);

export const FavoriteButton: Component<Props> = (props) => {
const [session, setSession] = createSignal<AuthSession | null>(null);
const [listNumber, setListNumber] = createSignal<string>("");
Expand All @@ -29,7 +32,7 @@ export const FavoriteButton: Component<Props> = (props) => {
const [notUser, setNotUser] = createSignal<boolean>(false);
const [loading, setLoading] = createSignal<boolean>(false);
const [signInToAdd, setSignInToAdd] = createSignal<boolean>(false);
const [favoritesLists, setFavoritesLists] = createSignal<ListData[]>([]);
// const [favoritesLists, setFavoritesLists] = createSignal<ListData[]>([]);

onMount(async () => {
if (UserError) {
Expand All @@ -47,8 +50,8 @@ export const FavoriteButton: Component<Props> = (props) => {
}

if (session() !== null) {
getFavorites();
getLists();
await getFavorites();
await getLists();
}
});

Expand Down Expand Up @@ -127,6 +130,7 @@ export const FavoriteButton: Component<Props> = (props) => {

const getFavoriteLists = async () => {
setLoading(true);
console.log("Updating lists");

if (notUser() === false) {
const response = await fetch("/api/getUserFavorites", {
Expand All @@ -143,6 +147,7 @@ export const FavoriteButton: Component<Props> = (props) => {
if (data) {
console.log(data);
setFavoritesLists(data.lists);
console.log(favoritesLists());
}
if (response.status !== 200) {
alert(data.message);
Expand Down Expand Up @@ -177,8 +182,9 @@ export const FavoriteButton: Component<Props> = (props) => {
console.log(data);
closeModal(buttonId, e);
setAdded(true);
getFavoriteLists();
getFavorites();
console.log("Please update lists");
await getFavoriteLists();
await getFavorites();
setTimeout(() => setAdded(false), 3000);
}
}
Expand Down Expand Up @@ -224,54 +230,6 @@ export const FavoriteButton: Component<Props> = (props) => {
<Show when={!isFavorited()}>
<Show when={!notUser()}>
<Modal
children={
<div>
<div
id="holder"
class="flex flex-row flex-wrap justify-start"
>
<Show
when={
favoritesLists().length > 0 &&
!loading()
}
>
{favoritesLists().map((list) => (
<button
class="flex w-40 flex-col p-2"
onclick={(e) => {
e.preventDefault();
e.stopPropagation();

addToFavorites(
e,
list.list_number,
`addFavoriteBtn ${props.id}`
);
}}
>
{listImages(list)}
<div class="mt-2 line-clamp-2 font-bold">
{list.list_name}
</div>
<div class="">
{list.count +
" " +
t(
"postLabels.resources"
)}
</div>
</button>
))}
</Show>
</div>
<CreateFavoriteList
lang={lang}
user_id={session()?.user.id || ""}
onListCreated={getFavoriteLists}
/>
</div>
}
heading={"Save To"}
buttonId={`addFavoriteBtn ${props.id}`}
buttonClass="absolute right-0 top-0 z-30"
Expand Down Expand Up @@ -315,7 +273,52 @@ export const FavoriteButton: Component<Props> = (props) => {
</svg>
}
headingLevel={6}
></Modal>
>
<div>
<div
id="holder"
class="flex flex-row flex-wrap justify-start"
>
<Show
when={
favoritesLists().length > 0 &&
!loading()
}
>
{favoritesLists().map((list) => (
<button
class="flex w-40 flex-col p-2"
onclick={(e) => {
e.preventDefault();
e.stopPropagation();

addToFavorites(
e,
list.list_number,
`addFavoriteBtn ${props.id}`
);
}}
>
{listImages(list)}
<div class="mt-2 line-clamp-2 font-bold">
{list.list_name}
</div>
<div class="">
{list.count +
" " +
t("postLabels.resources")}
</div>
</button>
))}
</Show>
</div>
<CreateFavoriteList
lang={lang}
user_id={session()?.user.id || ""}
onListCreated={getFavoriteLists}
/>
</div>
</Modal>
</Show>
<Show when={notUser()}>
<button
Expand Down
3 changes: 2 additions & 1 deletion src/components/posts/CreateEditPost.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,7 @@ export const CreateEditPost: Component<Props> = (props) => {
<Banner
content={
<Modal
buttonClass=""
buttonClass="text-btn1Text dark:text-btn1Text-DM"
buttonId="scavenger3"
buttonContent={t("huntModal.buttonContentDiscount")}
buttonAriaLabel={t("huntModal.buttonAriaDiscount")}
Expand Down Expand Up @@ -1120,6 +1120,7 @@ export const CreateEditPost: Component<Props> = (props) => {
<div class="flex items-center text-lg">
<p>
{t("formLabels.images")} ({imageUrl().length}/5)
<span class="text-alert1">* </span>
</p>

<div class="ml-2 flex items-end justify-end">
Expand Down
4 changes: 3 additions & 1 deletion src/components/posts/ViewUserFavorites.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ export const ViewUserFavorites: Component = () => {
alert(t("messages.noPosts"));
setFavoritedItems([]);
setLoading(false);
await getFavorites();
}
};

Expand Down Expand Up @@ -229,9 +230,10 @@ export const ViewUserFavorites: Component = () => {
<div class="relative mb-4 flex w-full flex-row justify-start text-2xl font-bold">
<button
class="mr-2 flex items-start"
onclick={(e) => {
onclick={async (e) => {
e.preventDefault();
e.stopPropagation();
await getFavorites();
setFavoritedItems([]);
}}
>
Expand Down
1 change: 1 addition & 0 deletions src/components/services/FiltersMobile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,7 @@ export const FiltersMobile: Component<Props> = (props) => {
setPriceFilterMax(500);
setPriceFilterMin(0);
}
props.filterPostsByPrice(priceFilterMin(), priceFilterMax());
}

function setSubjectFilter(id: number) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/services/ResourcesMain.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ export const ResourcesView: Component = () => {
<Banner
content={
<Modal
buttonClass=""
buttonClass="text-btn1Text dark:text-btn1Text-DM"
buttonId="scavenger1"
buttonContent={t("huntModal.buttonContent")}
buttonAriaLabel={t("huntModal.buttonAria")}
Expand Down
8 changes: 4 additions & 4 deletions src/content/policies/en/terms.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The individual listing the Resource or Event (“Creator”) is solely responsib

Users of the LearnGrove Marketplace include members (“Members”) who have registered for a buyer or seller account (“Account”) and visitors (“Visitors”) who browse the marketplace without registering for an Account (“Visitors”). Together Members and Visitors are our users (“Users”).

By using our Services as a Visitor, Member, or in any other manner, you agree to follow these Terms, including the terms of our [Privacy Policy](/privacy), [Copyright & Trademark Policy](/policies/copyright), [Community Guidelines](/policies/community), [Seller Fees and Payout Rates Policy](/policies/seller) and any other terms or policies which are incorporated as part of these Terms.
By using our Services as a Visitor, Member, or in any other manner, you agree to follow these Terms, including the terms of our [Privacy Policy](/privacy), [Copyright & Trademark Policy](/policies/copyright), [Community Guidelines](https://support.learngrove.co/frequently-asked/community-guidelines/), [Seller Fees and Payout Rates Policy](https://support.learngrove.co/creators-fees/) and any other terms or policies which are incorporated as part of these Terms.

## 1. Membership

Expand Down Expand Up @@ -89,7 +89,7 @@ If you’re a Creator, any Resources or Events you’ve posted will no longer be

### a. Community Guidelines

As a User of our Services, you are required to follow our [Community Guidelines](/policies/community) which are incorporated as part of these Terms. We may modify or add to these rules at our discretion. If you violate any of these rules, we may take action against your Account, such as removing Content you’ve posted, removing Resources from your Account, suspending or terminating your Account, removing Resources from your Buyer, issuing a refund to your Buyer(s), or any additional action that we deem necessary.
As a User of our Services, you are required to follow our [Community Guidelines](https://support.learngrove.co/frequently-asked/community-guidelines/) which are incorporated as part of these Terms. We may modify or add to these rules at our discretion. If you violate any of these rules, we may take action against your Account, such as removing Content you’ve posted, removing Resources from your Account, suspending or terminating your Account, removing Resources from your Buyer, issuing a refund to your Buyer(s), or any additional action that we deem necessary.

### b. Comments, Ratings & Reviews

Expand Down Expand Up @@ -180,7 +180,7 @@ Refund requests may be submitted to support@learngrove.co for the following reas

### b. Earnings

For each sale through the LearnGrove marketplace, sellers will be paid with the formula stated on our [Seller Fees and Payouts policy](/policies/seller). Datagrove may change the payout policy at its discretion. Changes will be communicated to Sellers prior to their effective date.
For each sale through the LearnGrove marketplace, sellers will be paid with the formula stated on our [Seller Fees and Payouts policy](https://support.learngrove.co/creators-fees/). Datagrove may change the payout policy at its discretion. Changes will be communicated to Sellers prior to their effective date.

**Payouts.** Sellers may initiate a payout at their discretion through their seller account page. Payouts will automatically be dispersed after two years in accordance with United States requirements if a Seller does not initiate a payout manually.

Expand All @@ -196,7 +196,7 @@ Sellers are responsible for the collection and payment of sales tax, use tax, go
- Product Tax Codes. You must provide an accurate tax code for each Listing. In cases where there is a pre-populated tax code you must verify that the tax code is correct. You may be liable for any under payments or penalties as a result of misclassification of your Listing.
- Indemnification. You agree to indemnify and hold harmless Datagrove, its employees, officers, directors, agents, and affiliates from and against all costs, expenses, damages, judgments, and liabilities including attorney’s fees resulting from allegations, threats, claims, suits, or other proceedings bring by any taxing authority, related to your failure to properly remit any taxes which are owed by you in connection with your use of the Services.

**Our Obligations.** Beginning on the start date identified for each jurisdiction, Datagrove will calculate, collect, and remit Sales Tax on applicable orders in accordance with our list of [Marketplace Collection Agreements](/policies/salestax). You hereby authorize us to engage in marketplace collection on your behalf and you understand that we may cease such collection at any time. You are responsible for ensuring proper registration, collection, and remittance of sales tax on your sales.
**Our Obligations.** Beginning on the start date identified for each jurisdiction, Datagrove will calculate, collect, and remit Sales Tax on applicable orders in accordance with our list of [Marketplace Collection Agreements](https://support.learngrove.co/creators-taxes/). You hereby authorize us to engage in marketplace collection on your behalf and you understand that we may cease such collection at any time. You are responsible for ensuring proper registration, collection, and remittance of sales tax on your sales.

## 6. Privacy

Expand Down
Loading