Skip to content

Landing Page#160

Merged
benjaminJohnson2204 merged 9 commits into
mainfrom
06Unnati/landingPage
Dec 19, 2025
Merged

Landing Page#160
benjaminJohnson2204 merged 9 commits into
mainfrom
06Unnati/landingPage

Conversation

@06unnati

@06unnati 06unnati commented May 14, 2025

Copy link
Copy Markdown
Contributor

Tracking Info

Resolves #115

CSS Checklist

  • Do you have width, padding, margin with a high (> ~ 100px) or negative value? Do you need it? Can rem em % vw vh be used instead?
  • Did you avoid hard coding positions? (position, top, left, rules) Can display:flex; and justify and align uses be used instead?

Changes

I created the landing page itself.

Testing

did npm run dev to see and added a link to the landing page.

Confirmation of Change

I created fake posts to see if it looked right.

@06unnati 06unnati requested a review from Miyuki-L as a code owner May 14, 2025 02:55

@Miyuki-L Miyuki-L left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The code isn't working as intended. There are various view places to be fixed up

Comment thread frontend/next.config.ts

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why do we need change this ?

Comment thread frontend/src/api/discussion.ts Outdated

export const getPost = async (): Promise<APIResult<Discussion[]>> => {
try {
const response: Response = await get("/api/discussions");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

#158
make the chagnes here to the get like the chagnes to the createPost in this PR.

You should be sending the firebase token in to this getPost function and to the get function

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This still needs to be addressed.

getPost function needs to take in a firebase token which is then passed to the get function after callling createAuthHeader on the firebase token

Comment thread frontend/src/api/discussion.ts Outdated
return handleAPIError("Failed to fetch posts");
}

// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we should disable.

I think in our last 1-1 we can set lin 37 with as Discussion [] and it be good.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

put this in the path discussion

we don't need the separate landing page folder.


.searchInput {
display: flex;
width: 384.634px;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should never be using such a big px value since all screen sizes are not are the same at 384px would be too big for certain screens. We should use % value here and if you don't want it to get too small or too big min-width max-width would be friends

<option value="author-desc">{t("Author Z-A")}</option>
</select>

<svg

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

let's not put the actual svg code in here. You should be able export and upload the svg and put it in our frontend/public/icons and the inport from there.

Look at the navbar and nav card components on how to do it.

title: string;
content: string;
date: string;
author: string;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

author here is the mongodb userId for the person creating the post you need to in the backend call the userModal and get the name before return data.

Comment thread frontend/src/api/discussion.ts Outdated
)}

{/* If no posts */}
{posts.length === 0 && <div>{t("No posts yet.")}</div>}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

you need to add these translation key's into the en.json and pt.json and es.json files for the translation to actually work.

look at the signup pages and see how its done or even the translationDemo.tsx file

.postcard-divider {
width: 1px;
height: 100%;
/* height: 100%; */

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

delete if not using

Comment thread backend/src/controllers/discussion.ts Outdated
import { NextFunction, Response } from "express";
import { Types } from "mongoose";

import { getUserNameById } from "../helpers/userHelpers"; // Make sure this import exists

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

can we remove the comment on this line

Comment thread frontend/src/api/discussion.ts Outdated

export const getPost = async (): Promise<APIResult<Discussion[]>> => {
try {
const response: Response = await get("/api/discussions");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This still needs to be addressed.

getPost function needs to take in a firebase token which is then passed to the get function after callling createAuthHeader on the firebase token

Comment thread frontend/src/api/discussion.ts Outdated

const json: unknown = await response.json();

if (typeof window !== "undefined") {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why do wee needs this statement and the console, log

Comment thread frontend/src/api/discussion.ts Outdated
console.info("Fetched posts JSON:", json);
}

if (Array.isArray(json)) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we are calling our own backend and we know its expected shape and the backend return formmate won't change so there isn't much point in this conditional check. Just make sure you are parsing it correctly.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

it'll aways just use one of them since we won't be changing the response the backend provides

Comment thread frontend/src/app/discussion/page.tsx Outdated
const result = await getPost();

if (result.success) {
if (Array.isArray(result.data)) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

redundant if you checked in the getPost and here. If you really want to check just do it once.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

if it failes there it fails here. if it passes both pass

<div className={styles.sortContainer}>
<select className={styles.sortSelect} {...register("sort")}>
<option value="">{t("Sort By")}</option>
<option value="date-desc">{t("Newest First")}</option>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

you need to put this into the the en.json and es.json and pt.json for translation to work.
. better to not have space either.

i.e. t("newest-first")
would need a "newest-first" : "Newest First" in en.json "newest-first": "whatever it is in spanish" in es.json etc

or else it'll jsut default to the key which is what you are doing but its not correctly using the translation then.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

can we undo this?

Comment thread frontend/src/app/discussion/page.tsx Outdated
title: discussion.title,
content: discussion.message,
date: discussion.createdAt,
author: discussion.userId,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

shouldn't be using user id here
should be using the username you got from the now updated backend

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

image
Still using user id

void fetchPosts();
}, []);

useEffect(() => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

is this supposed to be for scroll?

It doesn't scroll.

The better option is just use css set the height of a container and then have overflow:scroll or a similar rule

const thisWeekPosts: Post[] = [];
const earlierPosts: Post[] = [];

visiblePosts.forEach((post) => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This and all the steps above might need to go into a useEffect for the sorting to take into effect. But I also think that we shouldn't have the splitting into sections if we do sorting.

So I think for rendering you have to check if there is sorting then display one way then dispay the other.

// post.content.toLowerCase().includes(searchQuery),
// );

// switch (data.sort) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

keeping this in here incase you still need sorting but the use effect below has pretty much the sae logic.

What i see happening is post is sorted but that sorted post list is never used and not correspondingly rendered on the page.

</div>
<div className={styles.searchForm}>
{/* Wrap the search input and 'Sort By' dropdown */}
<div className={styles.searchAllSortContainer}>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

image
still missing the icone for the srot.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

and can we make the color solid black when an actual sorted option is selected so its more obvious that they have selected an option

@benjaminJohnson2204 benjaminJohnson2204 merged commit 55ed0f8 into main Dec 19, 2025
2 checks passed
@benjaminJohnson2204 benjaminJohnson2204 deleted the 06Unnati/landingPage branch December 19, 2025 06:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dicussion: Landing Page

3 participants