Skip to content

UI overhaul: sidebar, friend list & DMs, auth UX improvements, and message rendering#5

Open
reodesureodesu wants to merge 18 commits into
codex/improve-app-uifrom
codex/fix-new-registration-error-and-add-features-06cpop
Open

UI overhaul: sidebar, friend list & DMs, auth UX improvements, and message rendering#5
reodesureodesu wants to merge 18 commits into
codex/improve-app-uifrom
codex/fix-new-registration-error-and-add-features-06cpop

Conversation

@reodesureodesu
Copy link
Copy Markdown
Owner

Motivation

  • Improve the chat UI and UX by adding a collapsible sidebar, friend management, and theme controls to make private conversations and global chat easier to use.
  • Provide clearer authentication flows and error feedback by surfacing friendly messages and supporting display name during registration via updateProfile.
  • Enhance message presentation with metadata, image attachments, search/filtering and adjustable font size for accessibility.

Description

  • Reworked index.html markup and CSS to introduce a sidebar, backdrop, header toolbar, status bar, dark theme, font-size slider (CSS variable --msg-font-size), and responsive layout changes.
  • Added friend management and DM support using Firestore helper APIs (setDoc, deleteDoc) and storing senderEmail/targetEmail on messages to enable 1:1 chats and per-friend selection UI.
  • Introduced a ui mapping object and new client logic: renderFriends, renderMessages, filteredMessages, formatTime, and helper functions for opening/closing the sidebar and setting status messages.
  • Updated Firebase imports to include updateProfile, doc, setDoc, and deleteDoc, replaced ad-hoc DOM handling with structured event handlers for register/login/logout/Google sign-in, message send (with image base64 handling), friend add/delete, search, theme toggle, and AI response integration.

Testing

  • No automated tests were added or executed as part of this change.

Codex Task

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2fbc6cb94a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread index.html
ui.authDiv.style.display = "none";
ui.chatDiv.style.display = "flex";

onSnapshot(query(collection(db, "messages"), orderBy("createdAt")), (snap) => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Scope message snapshot to authorized conversation

DM visibility is enforced only in filteredMessages, but this listener subscribes to the entire messages collection and downloads every document before filtering. In environments where authenticated users can read global chat documents (the previous model), users can still access other users' 1:1 message payloads via client-side inspection, so private chat data is exposed.

Useful? React with 👍 / 👎.

Comment thread index.html
renderMessages();
});

onSnapshot(collection(db, "users", user.uid, "friends"), (snap) => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Dispose old friend listener on auth changes

This onSnapshot is registered inside onAuthStateChanged but its unsubscribe handle is never saved or called, so each login adds another live listener. After logout/login or account switching, stale listeners continue firing against old user paths, causing duplicate renders and potential permission errors for the previous user.uid.

Useful? React with 👍 / 👎.

Comment thread index.html Outdated
text: ui.msgInput.value.trim(),
image: imageBase64,
name: auth.currentUser.displayName || (auth.currentUser.email || "匿名"),
senderEmail: auth.currentUser.email || "",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Normalize sender email before DM write

Friend emails are lowercased when added/selected, but senderEmail is written with raw auth.currentUser.email. When an account email includes uppercase characters, DM matching in filteredMessages uses strict equality against lowercased friend addresses, so recipients can miss valid messages in that 1:1 thread.

Useful? React with 👍 / 👎.

@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
line Ready Ready Preview, Comment Mar 2, 2026 10:24pm

# Vercel Speed Insights Implementation

## Summary
Successfully implemented Vercel Speed Insights tracking for this HTML-based LINE chat application.

## Changes Made

### Modified Files
- **index.html** - Added Vercel Speed Insights tracking scripts

## Implementation Details

### What was added:
Added the required Vercel Speed Insights scripts just before the closing `</body>` tag in index.html:

1. **Initialization script**: Creates the `window.si` function and `window.siq` queue for tracking data
2. **Speed Insights script**: Loads the Vercel Speed Insights tracking script from `/_vercel/speed-insights/script.js` with defer attribute

### Code added:
```html
<script>
  window.si = window.si || function () { (window.siq = window.siq || []).push(arguments); };
</script>
<script defer src="/_vercel/speed-insights/script.js"></script>
```

## Technical Notes

- This is an HTML-based project (no build tools or package manager required)
- According to Vercel's documentation, for HTML projects, no package installation is needed
- The scripts are placed before the closing `</body>` tag as recommended
- The defer attribute ensures the script loads after HTML parsing is complete
- After deployment to Vercel, the route `/_vercel/speed-insights/script.js` will be automatically available

## Next Steps for the User

1. **Enable Speed Insights in Vercel Dashboard**:
   - Go to your Vercel project dashboard
   - Navigate to the "Speed Insights" tab
   - Click "Enable" to activate the feature

2. **Deploy to Vercel**:
   - Deploy the updated HTML file to Vercel
   - Speed Insights will begin collecting data after deployment

3. **Verify Installation**:
   - After deployment, check the page source for the `/_vercel/speed-insights/script.js` script in the body tag
   - Visit the Speed Insights dashboard to view collected metrics

## References
- Vercel Speed Insights Documentation: https://vercel.com/docs/speed-insights
- HTML Implementation Guide: https://vercel.com/docs/speed-insights/quickstart

Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
…s-to-proje-0nbp3z

Add Vercel Speed Insights to project
vercel Bot and others added 2 commits March 2, 2026 22:23
# Vercel Web Analytics Implementation

Successfully implemented Vercel Web Analytics for this plain HTML project.

## Changes Made

### Modified Files:
- `index.html` - Added Vercel Web Analytics tracking scripts

## Implementation Details

Added two script tags just before the closing `</head>` tag in `index.html`:

1. **Analytics initialization script**: Initializes the `window.va` function and queue (`window.vaq`) for tracking events
2. **Analytics tracking script**: Loads the Vercel insights script asynchronously using `defer` attribute

The implementation follows the official Vercel documentation for plain HTML sites, which requires:
- No package installation (no `@vercel/analytics` package needed)
- Simple script tag addition to HTML files
- Note: Route support is not available for plain HTML implementations

## What This Enables

Once the site is deployed to Vercel with Web Analytics enabled in the dashboard:
- Automatic tracking of page views and visitor data
- The tracking script will be loaded from `/_vercel/insights/script.js`
- Analytics data will be available in the Vercel dashboard under the Analytics tab

## Next Steps

To complete the setup:
1. Deploy the site to Vercel using `vercel deploy`
2. Enable Web Analytics in the Vercel dashboard (Project → Analytics tab → Enable)
3. Once deployed and enabled, verify the implementation by checking the browser's Network tab for requests to `/_vercel/insights/view`
4. View analytics data in the Vercel dashboard after users visit the site

## Technical Notes

- This is a plain HTML project with no build system or package dependencies
- The implementation uses the standard HTML approach as documented in the Vercel Web Analytics guide
- The scripts are placed in the `<head>` section with `defer` attribute for optimal loading performance
- No changes to project structure or additional files were necessary

Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
…alytics-se-df8esp

Enable Vercel Web Analytics setup guide
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant