diff --git a/src/components/posts/FullPostView.tsx b/src/components/posts/FullPostView.tsx index 17daab8..f26918b 100644 --- a/src/components/posts/FullPostView.tsx +++ b/src/components/posts/FullPostView.tsx @@ -124,7 +124,6 @@ export const ViewFullPost: Component = (props) => { } else { setPost(userRes.body[0]); setPostImages(userRes.body[0].image_signedUrls); - console.log("this is the post:", post()); } } else if (res.body.length < 1 && User.session === null) { alert(t("messages.noPost")); @@ -132,7 +131,6 @@ export const ViewFullPost: Component = (props) => { } else { setPost(res.body[0]); setPostImages(res.body[0].image_signedUrls); - console.log("post() in FullPostView:", post()); } } catch (error) { console.log(error); @@ -173,7 +171,6 @@ export const ViewFullPost: Component = (props) => { function showSlide(n: number) { let i; const slides = document.getElementsByClassName("slide"); - // console.log(slides) const dots = document.getElementsByClassName("dot"); if (n > slides.length) { @@ -413,7 +410,6 @@ export const ViewFullPost: Component = (props) => { qa.classList.add("hidden"); } } - // console.log(postImages()); return (
diff --git a/src/components/posts/ReviewPurchasedResource.tsx b/src/components/posts/ReviewPurchasedResource.tsx index d7d00d3..d3016f0 100644 --- a/src/components/posts/ReviewPurchasedResource.tsx +++ b/src/components/posts/ReviewPurchasedResource.tsx @@ -24,7 +24,6 @@ interface Props { postCreator: string; purchaseDate: string; createdDate: string; - // review: string; } async function postFormData(formData: FormData) { @@ -105,7 +104,6 @@ export const ReviewPurchasedResource: Component = (props) => { setDbReviewNum(reviewerRating); if (reviewerRating) { - console.log("reviewerRating was true"); setShowReviewForm(false); } } catch (err) { @@ -118,45 +116,6 @@ export const ReviewPurchasedResource: Component = (props) => { }); setLoading(false); } - - // try { - // //Refactor: We aren't going to want to load all the reviews every time, probably need pagination - // //So we will need to do checks like "has this been reviewed by this user" on the server/API call - // const data = await fetchPostReviews(props.resourceId.toString()); - // setReviewsData(data.body); - // } catch (err) { - // console.error(err); - // } finally { - // const arrayLength = () => reviewsData().length; - // if (arrayLength() === 0) { - // setShowReviewForm(true); - // setLoading(false); - // return; - // } - // reviewsData().map((review: Review) => { - // if (review.reviewer_id === props.userId) { - // return; - // } else { - // setShowReviewForm(true); - // } - // }); - - // // Set loading to false after fetch is complete - // setLoading(false); - // setTotalReviews(arrayLength); - // // Refactor: I would like to see this done on the server as part of the fetch if possible I think it will probably be faster - // // plus we won't want to return every single review but we will need to use them all to calculate this. - // // Might need to use a SQL query of some kind to store the average for the post in the view? Calculating this continually will be slow. - // if (arrayLength() > 0) { - // reviewsData().map((review: Review) => { - // setTotalRatingOfPost( - // review.overall_rating + totalRatingOfPost() - // ); - // }); - // setTotalRatingOfPost(totalRatingOfPost() / totalReviews()); - // setTotalRatingOfPost(Math.round(totalRatingOfPost() * 2) / 2); - // } - // } }); createEffect(async () => { @@ -166,7 +125,6 @@ export const ReviewPurchasedResource: Component = (props) => { let reviewerRating = data.body[0].overall_rating; setDbReviewNum(reviewerRating); if (reviewerRating) { - console.log("reviewerRating was true"); setShowReviewForm(false); } } @@ -175,8 +133,6 @@ export const ReviewPurchasedResource: Component = (props) => { async function submit(e: SubmitEvent, buttonId: string) { e.preventDefault(); - console.log(overallRating(), reviewTitle(), reviewText()); - if (overallRating() === "") { setShowReviewFieldAlert(true); @@ -542,7 +498,7 @@ export const ReviewPurchasedResource: Component = (props) => {
@@ -732,15 +688,6 @@ export const ReviewPurchasedResource: Component = (props) => { - {/* - setOverallRating(e.target.value) - } - /> */} {/*
*/} @@ -813,7 +760,7 @@ export const ReviewPurchasedResource: Component = (props) => { p-2 text-sm text-ptext2 transition-opacity peer-hover:visible dark:bg-background2-DM dark:text-ptext2-DM md:translate-x-1/4 md:translate-y-0" > {t( - "formLabels.reviewTitleDescription" + "toolTips.reviewTitleDescription" )}
@@ -866,7 +813,7 @@ export const ReviewPurchasedResource: Component = (props) => { p-2 text-sm text-ptext2 transition-opacity peer-hover:visible dark:bg-background2-DM dark:text-ptext2-DM md:translate-x-1/4 md:translate-y-0" > {t( - "formLabels.reviwTextDescription" + "toolTips.reviewTextDescription" )} @@ -896,7 +843,6 @@ export const ReviewPurchasedResource: Component = (props) => { {response() && (

{response().message} - {/* {t("messages.submitted")} */}

)} diff --git a/src/components/posts/ViewPostReviews.tsx b/src/components/posts/ViewPostReviews.tsx index 0408078..6c54b2b 100644 --- a/src/components/posts/ViewPostReviews.tsx +++ b/src/components/posts/ViewPostReviews.tsx @@ -24,7 +24,6 @@ export const ViewPostReviews: Component = (props) => { ); onMount(async () => { - console.log("props.resourceID: ", props.resourceID); await fetchReviews(props.resourceID); }); @@ -40,8 +39,6 @@ export const ViewPostReviews: Component = (props) => { setReviewsArray(data.body); - console.log("ReviewsArray: ", reviewsArray()); - return data; } diff --git a/src/i18n/UI/English.ts b/src/i18n/UI/English.ts index 93de081..b59f2a6 100644 --- a/src/i18n/UI/English.ts +++ b/src/i18n/UI/English.ts @@ -288,7 +288,6 @@ export const English = { downloadable: "Downloadable", whatDidYouThink: "What did you think?", overallRating: "Overall Rating", - overallRatingDescription: "Please rate this resource on a scale of one to five, with one being the lowest rating and five being the highest.", reviewQ1: "As described", reviewQ2: "Age/grade appropriate", reviewQ3: "Engaging", @@ -296,9 +295,7 @@ export const English = { reviewQ5: "Easy to use/implement", reviewQ6: "Fair price", reviewTitle: "Review Title", - reviewTitleDescription: "The review title will appear at the top of your review. A short and specific description is recommended for the review title.", reviewText: "Review Text", - reviwTextDescription: "The review text field provides more space for you to further explain your overall rating. We recommend one to three paragraphs.", priceFilter: "Price", freeResources: "Free Resources", listName: "List Name", @@ -399,7 +396,10 @@ export const English = { "Tax category determines how sales tax will be calculated in states where LearnGrove collects and remits tax on your behalf. As stated in the Terms you are responsible for choosing the appropriate tax category for each resource you list. Click the link below to learn more.", resourceTypes: "Please select all applicable resource types.", price: "The price entered is the price charged to the customer. The creator will receive the remaining amount after fees. See Terms for more information about the LearnGrove fee structure.", - secular: "LearnGrove acknowledges that a secular curriculum or resource could mean different things to different creators, learners and learning facilitators. At LearnGrove we use this term to refer to both faith-neutral resources as well as those that may teach a world view that is not in alignment with any particular religion but may teach concepts that are in direct conflict with particular religion. We leave it up to our creators to determine if they feel their resources are suitable for a secular environment. We strongly recommend that you include additional detail in your description to detail how your resource addresses various topics such as creation vs evolution, religious literary texts, etc." + secular: "LearnGrove acknowledges that a secular curriculum or resource could mean different things to different creators, learners and learning facilitators. At LearnGrove we use this term to refer to both faith-neutral resources as well as those that may teach a world view that is not in alignment with any particular religion but may teach concepts that are in direct conflict with particular religion. We leave it up to our creators to determine if they feel their resources are suitable for a secular environment. We strongly recommend that you include additional detail in your description to detail how your resource addresses various topics such as creation vs evolution, religious literary texts, etc.", + overallRatingDescription: "Please rate this resource on a scale of one to five, with one being the lowest rating and five being the highest.", + reviewTitleDescription: "The review title will appear at the top of your review. A short and specific description is recommended for the review title.", + reviewTextDescription: "The review text field provides more space for you to further explain your overall rating. We recommend one to three paragraphs.", }, apiErrors: { @@ -436,7 +436,9 @@ export const English = { singleListFavoriteError: "Error getting single list favorites", favoriteListError: "Error fetching favorite list", multipleListFavoriteError: "Error handling multiple lists", - }, + problemPostingReview: "We're sorry, there was an issue posting your review. Please try again or contact LearnGrove support.", + noDataFound: "No data found", + }, socialModal: { shareService: "Share this resource", diff --git a/src/i18n/UI/French.ts b/src/i18n/UI/French.ts index fcb19a7..e0dc745 100644 --- a/src/i18n/UI/French.ts +++ b/src/i18n/UI/French.ts @@ -289,7 +289,6 @@ export const French = { downloadable: "Téléchargeable", whatDidYouThink: "Qu'en as-tu pensé?", overallRating: "Note Globale", - overallRatingDescription: "Veuillez évaluer cette ressource sur une échelle de un à cinq, un étant la note la plus basse et cinq la plus élevée.", reviewQ1: "Comme décrit", reviewQ2: "Adapté à l'âge", reviewQ3: "Engageante", @@ -297,9 +296,7 @@ export const French = { reviewQ5: "Facile à utiliser/mettre en œuvre", reviewQ6: "Juste prix", reviewTitle: "Titre de la Revue", - reviewTitleDescription: "Le titre de votre avis apparaîtra en haut de votre avis. Une description courte et précise est recommandée pour le titre de votre avis.", reviewText: "Texte de le Revue", - reviewTextDescription: "Le champ de texte de l'avis vous offre plus d'espace pour expliquer plus en détail votre note globale. Nous vous recommandons d'écrire un à trois paragraphes.", priceFilter: "Prix", freeResources: "Ressources gratuites", listName: "Nom de la Liste", @@ -399,6 +396,9 @@ export const French = { resourceTypes: "Veuillez sélectionner tous les types de ressources applicables.", price: "Le prix saisi est le prix facturé au client. Le créateur recevra le montant restant après frais. Consultez les conditions pour plus d'informations sur la structure tarifaire LearnGrove.", secular: "LearnGrove reconnaît qu'un programme ou une ressource laïque peut signifier différentes choses pour différents créateurs, apprenants et facilitateurs d'apprentissage. Chez LearnGrove, nous utilisons ce terme pour désigner à la fois les ressources neutres en matière de foi ainsi que celles qui peuvent enseigner une vision du monde qui n'est pas conforme à une religion particulière, mais qui peuvent enseigner des concepts qui sont en conflit direct avec une religion particulière. Nous laissons à nos créateurs le soin de déterminer s'ils estiment que leurs ressources sont adaptées à un environnement laïc. Nous vous recommandons fortement d'inclure des détails supplémentaires dans votre description pour détailler la manière dont votre ressource aborde divers sujets tels que la création par rapport à l'évolution, les textes littéraires religieux, etc.", + overallRatingDescription: "Veuillez évaluer cette ressource sur une échelle de un à cinq, un étant la note la plus basse et cinq la plus élevée.", + reviewTitleDescription: "Le titre de votre avis apparaîtra en haut de votre avis. Une description courte et précise est recommandée pour le titre de votre avis.", + reviewTextDescription: "Le champ de texte de l'avis vous offre plus d'espace pour expliquer plus en détail votre note globale. Nous vous recommandons d'écrire un à trois paragraphes.", }, apiErrors: { @@ -432,7 +432,9 @@ export const French = { emailNotConfirmed: "Correo electrónico no registrado. Si registró previamente esta dirección de correo electrónico, utilice la opción de olvidé mi contraseña que aparece a continuación; de lo contrario, utilice la opción de registro que aparece a continuación.", noFavoriteLists: "Aucune liste de favoris trouvée", - }, + problemPostingReview: "Nous sommes désolés, un problème est survenu lors de la publication de votre avis. Veuillez réessayer ou contacter le support LearnGrove.", + noDataFound: "Aucune donnée trouvée", + }, socialModal: { shareService: "Partager ce ressource", diff --git a/src/i18n/UI/Spanish.ts b/src/i18n/UI/Spanish.ts index 85f3b2e..aa1ce30 100644 --- a/src/i18n/UI/Spanish.ts +++ b/src/i18n/UI/Spanish.ts @@ -291,7 +291,6 @@ export const Spanish = { downloadable: "Descargable", whatDidYouThink: "¿Qué pensó Ud?", overallRating: "Calificación General", - overallRatingDescription: "Califique este recurso en una escala del uno al cinco, siendo uno la calificación más baja y cinco la más alta.", reviewQ1: "Como se describe", reviewQ2: "Apropiado para edad/grado", reviewQ3: "Atractivo", @@ -299,9 +298,7 @@ export const Spanish = { reviewQ5: "Fácil de usar/implementar", reviewQ6: "Precio justo", reviewTitle: "Títula de la Calificación", - reviewTitleDescription: "El título de la reseña aparecerá en la parte superior de la misma. Se recomienda incluir una descripción breve y específica para el título de la reseña.", reviewText: "Texto de la Calificación", - reviewTextDescription: "El campo de texto de la reseña le ofrece más espacio para explicar con más detalle su calificación general. Recomendamos que incluya entre uno y tres párrafos.", priceFilter: "Precio", freeResources: "Recursos gratuitos", listName: "Nombre de la lista", @@ -402,6 +399,9 @@ export const Spanish = { resourceTypes: "Seleccione todos los tipos de recursos aplicables.", price: "El precio introducido es el precio cobrado al cliente. El creador recibirá el importe restante después de las tarifas. Consulte los Términos para obtener más información sobre la estructura de tarifas de LearnGrove.", secular: "LearnGrove reconoce que un plan de estudios o recurso secular podría significar cosas diferentes para diferentes creadores, estudiantes y facilitadores de aprendizaje. En LearnGrove utilizamos este término para referirnos tanto a los recursos neutrales a la fe como a aquellos que pueden enseñar una visión del mundo que no está alineada con ninguna religión en particular, pero que pueden enseñar conceptos que están en conflicto directo con una religión en particular. Dejamos en manos de nuestros creadores determinar si creen que sus recursos son adecuados para un entorno secular. Le recomendamos encarecidamente que incluya detalles adicionales en su descripción para detallar cómo su recurso aborda diversos temas, como creación versus evolución, textos literarios religiosos, etc.", + overallRatingDescription: "Califique este recurso en una escala del uno al cinco, siendo uno la calificación más baja y cinco la más alta.", + reviewTitleDescription: "El título de la reseña aparecerá en la parte superior de la misma. Se recomienda incluir una descripción breve y específica para el título de la reseña.", + reviewTextDescription: "El campo de texto de la reseña le ofrece más espacio para explicar con más detalle su calificación general. Recomendamos que incluya entre uno y tres párrafos.", }, apiErrors: { @@ -432,7 +432,9 @@ export const Spanish = { emailNotConfirmed: "Correo electrónico no registrado. Si registró previamente esta dirección de correo electrónico, utilice la opción de olvidé mi contraseña que aparece a continuación; de lo contrario, utilice la opción de registro que aparece a continuación.", noFavoriteLists: "No se encontraron lista de favoritos", - }, + problemPostingReview: "Lo sentimos, se produjo un problema al publicar tu reseña. Vuelve a intentarlo o ponte en contacto con el servicio de asistencia de LearnGrove.", + noDataFound: "No se encontraron datos", + }, socialModal: { shareService: "Comparte este recurso", diff --git a/src/i18n/uiType.ts b/src/i18n/uiType.ts index 69f0236..7d9e2ec 100644 --- a/src/i18n/uiType.ts +++ b/src/i18n/uiType.ts @@ -279,7 +279,7 @@ export interface uiObject { downloadable: string; whatDidYouThink: string; overallRating: string; - overallRatingDescription: string, + reviewQ1: string; reviewQ2: string; reviewQ3: string; @@ -287,9 +287,9 @@ export interface uiObject { reviewQ5: string; reviewQ6: string; reviewTitle: string; - reviewTitleDescription: string; + reviewText: string; - reviewTextDescription: string; + priceFilter: string; freeResources: string; listName: string; @@ -370,6 +370,9 @@ export interface uiObject { resourceTypes: string; price: string; secular: string; + overallRatingDescription: string, + reviewTitleDescription: string; + reviewTextDescription: string; }; apiErrors: { @@ -404,6 +407,8 @@ export interface uiObject { singleListFavoriteError: string; favoriteListError: string; multipleListFavoriteError: string; + problemPostingReview: string; + noDataFound: string; }; socialModal: { diff --git a/src/pages/api/clientSubmitReviewResource.ts b/src/pages/api/clientSubmitReviewResource.ts index e790498..91fc446 100644 --- a/src/pages/api/clientSubmitReviewResource.ts +++ b/src/pages/api/clientSubmitReviewResource.ts @@ -32,8 +32,8 @@ export const POST: APIRoute = async ({ request, redirect }) => { // Validate the formData makes sure none of the fields are blank. Could probably do more than this like check for invalid phone numbers, blank strings, unselected location info etc. if ( - !reviewTitle || - !reviewText || + // !reviewTitle || + // !reviewText || !overallRating || !resourceId || !userId || @@ -91,8 +91,8 @@ export const POST: APIRoute = async ({ request, redirect }) => { let submission = { resource_id: resourceId, reviewer_id: userId, - review_title: reviewTitle, - review_text: reviewText, + review_title: reviewTitle || null, + review_text: reviewText || null, overall_rating: overallRating, }; @@ -107,7 +107,7 @@ export const POST: APIRoute = async ({ request, redirect }) => { JSON.stringify({ // message: t("apiErrors.creatorCreateProfileError"), //TODO: Internationalize - message: "fail to insert " + message: t("apiErrors.problemPostingReview") }), { status: 500 } ); @@ -116,7 +116,7 @@ export const POST: APIRoute = async ({ request, redirect }) => { JSON.stringify({ // message: t("apiErrors.noProfileData"), //TODO: Internationalize - message: "fail data fetch", + message: t("apiErrors.noDataFound"), }), { status: 500 } ); diff --git a/src/pages/api/fetchFilterPosts.ts b/src/pages/api/fetchFilterPosts.ts index 253584a..392d292 100644 --- a/src/pages/api/fetchFilterPosts.ts +++ b/src/pages/api/fetchFilterPosts.ts @@ -32,9 +32,6 @@ export const POST: APIRoute = async ({ request, redirect }) => { const values = ui[lang] as uiObject; const postSubjects = values.subjectCategoryInfo.subjects; const postSubtopics = values.subjectCategoryInfo.subtopics; - // console.log("From: ", from); - // console.log(" To: ", to); - // console.log(subtopics); try { let query = supabase @@ -93,8 +90,6 @@ export const POST: APIRoute = async ({ request, redirect }) => { query = query.lte("price_value", priceMax); } - // console.log(query) - const { data: posts, error } = await query; if (error) { @@ -106,9 +101,6 @@ export const POST: APIRoute = async ({ request, redirect }) => { { status: 500 } ); } - // else { - // console.log("Posts: ", posts.length); - // } const { data: gradeData, error: gradeError } = await supabase .from("grade_level") @@ -129,7 +121,6 @@ export const POST: APIRoute = async ({ request, redirect }) => { let formattedPosts: Post[] = []; if (posts && gradeData && resourceTypesData) { - // console.log(posts); formattedPosts = await Promise.all( posts.map(async (post: Post) => { diff --git a/src/styles/global.css b/src/styles/global.css index 15ffdef..26dfc5b 100644 --- a/src/styles/global.css +++ b/src/styles/global.css @@ -58,11 +58,6 @@ @apply my-2 mr-2 flex h-20 w-20 items-center justify-center rounded-full border-2 border-border1 text-ptext1 dark:border-border1-DM dark:text-ptext1-DM md:h-24 md:w-24 md:border-4; } - /* #user-profile-ratings-div { - unicode-bidi: bidi-override; - direction: rtl; - } */ - #user-profile-ratings-div > * { display: flex; justify-content: center; @@ -71,12 +66,6 @@ margin: 0px 2px; font-size: 18px; } - /* - #user-profile-ratings-div > span:hover:before, - #user-profile-ratings-div > span:hover ~ span:before { - content: "\2605"; - position: absolute; - } */ } @layer utilities {