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

Feature/ Add "series" to link related articles #1081

Open
John-Paul-Larkin opened this issue Oct 7, 2024 · 14 comments · May be fixed by #1146
Open

Feature/ Add "series" to link related articles #1081

John-Paul-Larkin opened this issue Oct 7, 2024 · 14 comments · May be fixed by #1146

Comments

@John-Paul-Larkin
Copy link
Member

John-Paul-Larkin commented Oct 7, 2024

Context

Implement a "Series" feature that allows users to link related articles together under a specific series, making it easier for readers to navigate through multi-part content. Similar to Dev.to's series functionality, this will enable authors to organize their content and guide readers through sequential posts.

Expected Behavior

  • Allow users to group related articles into a series.
    -Add a series field to the article creation form and database. This field will allow authors to specify the series title. Example: series: "Building a Fullstack App"
  • See Nialls comment below.
  • Automatic Navigation: Once an article is part of a series, the system should automatically generate navigation links at the top and bottom of the article: "Previous article" / "Next article" with clickable links.
  • Show Indication of the article’s place within the series (e.g., "Article 3 of 5").
  • Articles index in the series should be chronological based on the publication date.
@John-Paul-Larkin
Copy link
Member Author

@NiallJoeMaher
Can you review/Edit this to see if it is what you are looking for?

@NiallJoeMaher
Copy link
Contributor

In the more options screen we should add another input. Here is that screen:

Picture of the current more options for a publush screen

It is shown when you save a new post.

That input should have a title of "Series Name" and a placeholder of "The name of my series". The text below should say "This text is case-sensitive so make sure you type it exactly as you did in previous articles to ensure they are connected".

We will need a new Series table something like this:

CREATE TABLE IF NOT EXISTS "Series" (
    "id" SERIAL PRIMARY KEY,
    "title" text NOT NULL,
    "description" text,
    "userId" text NOT NULL,
    "createdAt" timestamp(3) with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    "updatedAt" timestamp(3) with time zone NOT NULL
);

But created with Drizzle.
And also to update the current Post table to include a relation to this with a seriesId. Something like:

"seriesId" integer,
...
FOREIGN KEY ("seriesId") REFERENCES "Series" ("id") ON DELETE CASCADE,

@RangerCreaky
Copy link
Contributor

I would like to work on this issue

@John-Paul-Larkin
Copy link
Member Author

Thanks @RangerCreaky

I assigned you.

@RangerCreaky
Copy link
Contributor

RangerCreaky commented Oct 10, 2024

Hey @John-Paul-Larkin
Just wanted to clarify on the UI

Links on the top:
links on the top

Links on the bottom:
links on the bottom

**Mobile view top: **
mobile view top

**Mobile view bottom: **
mobile view bottom

Dark View
dark view

All the links underlined when hovered on,

Can you please confirm this UI
Thank you

Copy link

Uh oh! @RangerCreaky, the image you shared is missing helpful alt text. Check #1081 (comment).

Alt text is an invisible description that helps screen readers describe images to blind or low-vision users. If you are using markdown to display images, add your alt text inside the brackets of the markdown image.

Learn more about alt text at Basic writing and formatting syntax: images on GitHub Docs.

@NiallJoeMaher
Copy link
Contributor

Hey @RangerCreaky, this issue is about creating the series link 🔗 It's not about showing the series within the article yet.

In the more options screen we should add another input. Here is that screen:

Picture of the current more options for a publush screen

It is shown when you save a new post.

That input should have a title of "Series Name" and a placeholder of "The name of my series". The text below should say "This text is case-sensitive so make sure you type it exactly as you did in previous articles to ensure they are connected".

We will need a new Series table something like this:

CREATE TABLE IF NOT EXISTS "Series" (
    "id" SERIAL PRIMARY KEY,
    "title" text NOT NULL,
    "description" text,
    "userId" text NOT NULL,
    "createdAt" timestamp(3) with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    "updatedAt" timestamp(3) with time zone NOT NULL
);

But created with Drizzle. And also to update the current Post table to include a relation to this with a seriesId. Something like:

"seriesId" integer,
...
FOREIGN KEY ("seriesId") REFERENCES "Series" ("id") ON DELETE CASCADE,

@RangerCreaky
Copy link
Contributor

RangerCreaky commented Oct 10, 2024

@NiallJoeMaher

Sorry I missed attaching the image to add the series link:

series link

However in the issue [The part which was not stroked off] as defined by @John-Paul-Larkin

Expected Behavior
Allow users to group related articles into a series.
-Add a series field to the article creation form and database. This field will allow authors to specify the series title. Example: series: "Building a Fullstack App"
See Nialls comment below.
Automatic Navigation: Once an article is part of a series, the system should automatically generate navigation links at the top and bottom of the article: "Previous article" / "Next article" with clickable links.
Show Indication of the article’s place within the series (e.g., "Article 3 of 5").
Articles index in the series should be chronological based on the publication

It also asks to show the navigation links on the top and the bottom of the article, Hence I considered the below points for this issue:

  1. While creating a post, another input should be shown to add the series name (as shown in the image attached in this comment)
  2. When the user lands up on an article which is a part of the series, they should also find previous and next links at the top and the bottom of the article (as shown in the images attached in the previous comment)

However, Please clarify if I understood something differently than expected...

@NiallJoeMaher
Copy link
Contributor

Image above is great! I need to make designs for number 2 that's the only reason I'm ignoring it for now. I'll hopefully get to it later today if you want me to assign it to you as a follow up issue when the initial series creation is done? Sorry for the confusion!

@RangerCreaky
Copy link
Contributor

Sure @NiallJoeMaher , I would love to take up the follow up issue. However, for now I will revert all the changes related to the showing of article on screen in the PR for this issue. Please do assign the next issue to me.

@RangerCreaky
Copy link
Contributor

RangerCreaky commented Oct 10, 2024

@NiallJoeMaher

We will need a new Series table something like this:

CREATE TABLE IF NOT EXISTS "Series" (
    "id" SERIAL PRIMARY KEY,
    "title" text NOT NULL,
    "description" text,
    "userId" text NOT NULL,
    "createdAt" timestamp(3) with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    "updatedAt" timestamp(3) with time zone NOT NULL
);

But created with Drizzle.
And also to update the current Post table to include a relation to this with a seriesId. Something like:

"seriesId" integer,
...
FOREIGN KEY ("seriesId") REFERENCES "Series" ("id") ON DELETE CASCADE,

I assume, by this you meant a new table (series), should be created in the db
And the posts table should be updated to have a new foreign key referencing the id column of the series table, which also has the ON DELETE CASCADE.

As of my understanding, this would mean, If the series record is deleted from the db, then it would automatically delete all the posts referencing that series.

Is this really what we want? Rather shouldn't it be other way around?
Deleting the last post of a particular series should delete the series itself.

However, In the current situation, I could write a trigger in the code, But this condition doesn't seem appropriate to me
Please Clarify

Ref: https://stackoverflow.com/questions/14141266/postgresql-foreign-key-on-delete-cascade

@RangerCreaky
Copy link
Contributor

@NiallJoeMaher @John-Paul-Larkin any update on my above query?

@NiallJoeMaher
Copy link
Contributor

@RangerCreaky sorry about the delay! You are absolutely correct and thanks for pointing that out. Don't delete on cascade or we will have some very sad users 😂

@RangerCreaky
Copy link
Contributor

Okay sure 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants