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

feat(survey): Support multiple surveys #194

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

Andreas02-dev
Copy link
Contributor

No description provided.

@Andreas02-dev Andreas02-dev added enhancement New feature or request Feature labels Mar 7, 2025
@Andreas02-dev Andreas02-dev added this to the Tech Survey 2025 milestone Mar 7, 2025
@Andreas02-dev Andreas02-dev self-assigned this Mar 7, 2025
@Andreas02-dev Andreas02-dev changed the title Feature/193 support multiple surveys feat(survey): Support multiple surveys Mar 7, 2025
@Andreas02-dev Andreas02-dev linked an issue Mar 7, 2025 that may be closed by this pull request
@Andreas02-dev Andreas02-dev marked this pull request as draft March 7, 2025 11:57
@Andreas02-dev Andreas02-dev marked this pull request as ready for review March 10, 2025 13:06
});

const selectedUser = users.find((user) => user.name === name);
const ContentSection = async ({ userId }: { userId?: string }) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's ask @nicojs about this:
There are two options here.
Option 1: Keep it as it is, searching by name. The url will be https://.../profile-page?name=Jelle%20Buitenhuis. However, names are not guaranteed to be unique, how would we handle that?
Option 2: Change it to userId, which is guaranteed to be unique. The url will be https://.../profile-page?id=cm893klj4h353457

Copy link
Contributor Author

@Andreas02-dev Andreas02-dev Mar 10, 2025

Choose a reason for hiding this comment

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

We could also use metadata to show the name of the user, social media apps also use this for link previews.
Quick code example would be:

const buildStaticMetadata = (): Metadata => {
    return {
        title: "Find the expert",
    };
};

const buildTitle = (userName: string | null): string => {
    if (userName === null) {
        return "Find the expert";
    }

    return `Find the expert - ${userName}`;
};

export async function generateMetadata({
    searchParams,
}: {
    searchParams: Promise<{ userId?: string }>;
}): Promise<Metadata> {
    const userId = (await searchParams).userId;
    if (!userId) {
        return buildStaticMetadata();
    }

    const user = await prismaClient.users.getUserById(userId);
    if (!user) {
        return buildStaticMetadata();
    }

    return {
        title: buildTitle(user.name),
        openGraph: {
            title: buildTitle(user.name),
        },
    };
}

Which would look something like:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat(survey): Support multiple surveys
3 participants