Skip to content

Conversation

@hashirjamal
Copy link
Collaborator

  • Login
  • Signup
  • Save Story
  • Unsave Story
  • Snack Bar
  • Save Limit
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements authentication functionality and story saving features for the Kidlytics app. The changes enable users to sign up, sign in, save stories to their personal collection, and manage their saved stories.

  • Authentication with email/password and Google sign-in
  • Story saving and unsaving with a 5-story limit per user
  • User interface for managing saved stories with confirmation dialogs

Reviewed Changes

Copilot reviewed 16 out of 19 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
src/constants/limits.constants.ts Defines save story limit constant
src/app/services/save.story.service.ts Implements story save/unsave logic with limit checking
src/app/services/auth.store.ts State management for authentication using signals
src/app/services/auth.service.ts Firebase authentication service methods
src/app/header/header.ts Updates header component with auth-aware navigation
src/app/header/header.html Adds conditional auth buttons and saved stories link
src/app/components/signup/signup.ts Signup component with form validation
src/app/components/signin/signin.ts Signin component with email and Google auth
src/app/components/my-stories/my-stories.ts Component for viewing and managing saved stories
src/app/components/display-story/display-story.ts Adds save story functionality to story viewer
src/app/app.routes.ts Adds routes for authentication and saved stories pages
firebase.ts Exports Firebase auth instance

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@@ -0,0 +1 @@
const NO_OF_SAVED_STORIES_ALLOWED = 5;
Copy link

Copilot AI Sep 23, 2025

Choose a reason for hiding this comment

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

The constant should be exported to be usable by other modules. Add 'export' keyword before 'const'.

Suggested change
const NO_OF_SAVED_STORIES_ALLOWED = 5;
export const NO_OF_SAVED_STORIES_ALLOWED = 5;
Copilot uses AI. Check for mistakes.
const snapshot = await getDocs(q);
const savedCount = snapshot.size;

if (savedCount >= 5) {
Copy link

Copilot AI Sep 23, 2025

Choose a reason for hiding this comment

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

Replace magic number 5 with the constant from limits.constants.ts. Import NO_OF_SAVED_STORIES_ALLOWED and use it here for better maintainability.

Copilot uses AI. Check for mistakes.
const storiesRef = collection(db, 'stories');
const q = query(storiesRef, where('savedBy', 'array-contains', uid));
const snapshot = await getDocs(q);
console.log(snapshot.docs);
Copy link

Copilot AI Sep 23, 2025

Choose a reason for hiding this comment

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

Remove console.log statement from production code. This debug output should not be included in the final implementation.

Suggested change
console.log(snapshot.docs);
Copilot uses AI. Check for mistakes.
// Subscribe to Firebase auth changes
onAuthStateChanged(auth, (firebaseUser) => {
this._user.set(firebaseUser);
console.log('STate changed', this.isLoggedIn());
Copy link

Copilot AI Sep 23, 2025

Choose a reason for hiding this comment

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

Fix typo: 'STate' should be 'State'. Also consider removing this console.log statement for production code.

Suggested change
console.log('STate changed', this.isLoggedIn());
Copilot uses AI. Check for mistakes.
imports: [CommonModule, RouterLink],
})
export class UserStoriesComponent {
userStories = signal<any[]>([]);
Copy link

Copilot AI Sep 23, 2025

Choose a reason for hiding this comment

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

Replace 'any[]' with a proper type definition. Consider creating an interface for the story data structure to improve type safety.

Copilot uses AI. Check for mistakes.
Comment on lines +37 to +38
} finally {
this.loading.set(false);
Copy link

Copilot AI Sep 23, 2025

Choose a reason for hiding this comment

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

Duplicate loading.set(false) calls. The loading state is set to false both inside the try block (line 34) and in the finally block (line 38). Remove the one from line 34 to avoid redundancy.

Copilot uses AI. Check for mistakes.

<button
type="submit"
class="btn-primary p-3 rounded-lg text-white font-bold transition hover:scale-105 disabled:opacity-50 cursor-pointer border b-5 shadow-lg"
Copy link

Copilot AI Sep 23, 2025

Choose a reason for hiding this comment

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

Fix CSS class typo: 'b-5' should be 'border-5' for proper border styling.

Suggested change
class="btn-primary p-3 rounded-lg text-white font-bold transition hover:scale-105 disabled:opacity-50 cursor-pointer border b-5 shadow-lg"
class="btn-primary p-3 rounded-lg text-white font-bold transition hover:scale-105 disabled:opacity-50 cursor-pointer border border-5 shadow-lg"
Copilot uses AI. Check for mistakes.

<button
type="submit"
class="btn-primary p-3 border b-2 rounded-lg text-white font-semibold transition hover:scale-105 disabled:opacity-50"
Copy link

Copilot AI Sep 23, 2025

Choose a reason for hiding this comment

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

Fix CSS class typo: 'b-2' should be 'border-2' for proper border styling.

Suggested change
class="btn-primary p-3 border b-2 rounded-lg text-white font-semibold transition hover:scale-105 disabled:opacity-50"
class="btn-primary p-3 border border-2 rounded-lg text-white font-semibold transition hover:scale-105 disabled:opacity-50"
Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants