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

Subject array display And Implementation #27

Merged
merged 17 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from 10 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
Binary file added signal-desktop-keyring.gpg
gerzarko marked this conversation as resolved.
Show resolved Hide resolved
Binary file not shown.
48 changes: 46 additions & 2 deletions src/assets/categoryIcons/holiday.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 18 additions & 18 deletions src/components/posts/ClientViewProviderPosts.tsx
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to update the productCategories forEach here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See Suggestions

Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import supabase from "../../lib/supabaseClient";
import { ui } from "../../i18n/ui";
import type { uiObject } from "../../i18n/uiType";
import { getLangFromUrl, useTranslations } from "../../i18n/utils";
import stripe from "@lib/stripe";
import stripe from "@lib/stripe";

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

//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.productCategoryInfo.categories;
const productCategories = values.subjectCategoryInfo.subjects;

interface ProviderPost {
user_id: string;
Expand Down Expand Up @@ -48,24 +48,24 @@ export const ClientViewProviderPosts: Component<Props> = (props) => {
console.log("supabase error: " + error.message);
} else {
const newItems = await Promise.all(
data?.map(async (item) => {
productCategories.forEach((productCategories) => {
if (item.product_subject.toString() === productCategories.id) {
item.subject = productCategories.name;
}
});
delete item.product_subject;
data?.map(async (item) => {
productCategories.forEach((productCategories) => {
if (item.product_subject.toString() === productCategories.id) {
gerzarko marked this conversation as resolved.
Show resolved Hide resolved
item.subject = productCategories.name;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
item.subject = productCategories.name;

}
gerzarko marked this conversation as resolved.
Show resolved Hide resolved
});
gerzarko marked this conversation as resolved.
Show resolved Hide resolved
delete item.product_subject;
gerzarko marked this conversation as resolved.
Show resolved Hide resolved

if (item.price_id !== null) {
const priceData = await stripe.prices.retrieve(item.price_id);
item.price = priceData.unit_amount! / 100;
}
return item;
}))
;
if (item.price_id !== null) {
const priceData = await stripe.prices.retrieve(item.price_id);
item.price = priceData.unit_amount! / 100;
}
return item;
}),
);
setPosts(data);
console.log("Posts")
console.log(posts())
console.log("Posts");
console.log(posts());
}
});
return (
Expand Down
Loading
Loading