Skip to content

Sidepanel/main#12

Merged
yamijuan merged 10 commits intomainfrom
sidepanel2
May 7, 2025
Merged

Sidepanel/main#12
yamijuan merged 10 commits intomainfrom
sidepanel2

Conversation

@yamijuan
Copy link
Collaborator

@yamijuan yamijuan commented May 7, 2025

PR Type

Enhancement


Description

  • Implement sidepanel UI for web archives

  • Add archive list with collapsible date groups

  • Create Material Design-based interface

  • Enable archive browsing and management


Changes walkthrough 📝

Relevant files
Enhancement
argo-archive-list.ts
Archive list component with date grouping                               

src/argo-archive-list.ts

  • Created new component to display archived pages grouped by date
  • Implemented collapsible date sections with Material Design components
  • Added checkbox selection functionality for archives
  • Implemented archive opening functionality with proper URL formatting
  • +223/-0 
    bg.ts
    Background script sidepanel support                                           

    src/ext/bg.ts

  • Added sidepanel handler to process messages from the sidepanel
  • Implemented functionality to retrieve archived pages
  • Added Chrome sidePanel API configuration
  • Refactored URL validation function
  • +87/-11 
    sidepanel.ts
    Main sidepanel implementation                                                       

    src/sidepanel.ts

  • Created main sidepanel implementation with Material Design components
  • Implemented archive viewing and recording controls
  • Added message handling for communication with background script
  • Implemented UI state management for recording status
  • +386/-0 
    sidepanel.html
    Sidepanel HTML structure and styling                                         

    static/sidepanel.html

  • Created HTML structure for the sidepanel
  • Added Material Design styling and components
  • Implemented tabs for different archive views
  • Added search functionality for archived pages
  • +99/-0   
    Configuration changes
    webpack.config.js
    Webpack configuration for sidepanel                                           

    webpack.config.js

    • Added sidepanel.ts to entry points for webpack build
    +1/-0     
    .prettierrc
    Prettier configuration                                                                     

    .prettierrc

  • Added Prettier configuration file with formatting rules
  • Set tab width to 2 spaces and line width to 120
  • +7/-0     
    manifest.json
    Extension manifest updates for sidepanel                                 

    src/ext/manifest.json

  • Added sidePanel permission
  • Added side_panel configuration with default path
  • Removed default_popup to use sidepanel instead
  • +6/-3     
    Dependencies
    package.json
    Material Design dependency                                                             

    package.json

  • Added @material/web dependency (v2.3.0) for Material Design components
  • +1/-0     

    Need help?
  • Type /help how to ... in the comments thread for any questions about PR-Agent usage.
  • Check out the documentation for more information.
  • @pr-agent-monadical
    Copy link

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Type Safety Issues

    The code contains numerous type assertions and suppressions with @ts-expect-error. This indicates potential type safety issues that should be properly addressed with proper typing rather than suppressing errors.

    class ArgoViewer extends LitElement {
      constructor() {
        super();
    
        // @ts-expect-error - TS2339 - Property 'collections' does not exist on type 'RecPopup'.
        this.collections = [];
        // @ts-expect-error - TS2339 - Property 'collTitle' does not exist on type 'RecPopup'.
        this.collTitle = "";
        // @ts-expect-error - TS2339 - Property 'collId' does not exist on type 'RecPopup'.
        this.collId = "";
    
        // @ts-expect-error - TS2339 - Property 'tabId' does not exist on type 'RecPopup'.
        this.tabId = 0;
        // @ts-expect-error - TS2339 - Property 'recording' does not exist on type 'RecPopup'.
        this.recording = false;
        // @ts-expect-error - TS2339 - Property 'status' does not exist on type 'RecPopup'.
        this.status = null;
    
        // @ts-expect-error - TS2339 - Property 'port' does not exist on type 'RecPopup'.
        this.port = null;
    
        // @ts-expect-error - TS2339 - Property 'pageUrl' does not exist on type 'RecPopup'.
        this.pageUrl = "";
        // @ts-expect-error - TS2339 - Property 'pageTs' does not exist on type 'RecPopup'.
        this.pageTs = 0;
        // @ts-expect-error - TS2339 - Property 'replayUrl' does not exist on type 'RecPopup'.
        this.replayUrl = "";
    
        // @ts-expect-error - TS2339 - Property 'canRecord' does not exist on type 'RecPopup'.
        this.canRecord = false;
        // @ts-expect-error - TS2339 - Property 'failureMsg' does not exist on type 'RecPopup'.
        this.failureMsg = null;
    
        // @ts-expect-error - TS2339 - Property 'collDrop' does not exist on type 'RecPopup'.
        this.collDrop = "";
    
        // @ts-expect-error - TS2339 - Property 'allowCreate' does not exist on type 'RecPopup'.
        this.allowCreate = true;
    
        // @ts-expect-error - TS2339 - Property 'waitingForStart' does not exist on type 'RecPopup'.
        this.waitingForStart = false;
        // @ts-expect-error - TS2339 - Property 'waitingForStop' does not exist on type 'RecPopup'.
        this.waitingForStop = false;
        // @ts-expect-error - TS2339 - Property 'behaviorState' does not exist on type 'RecPopup'.
        this.behaviorState = BEHAVIOR_WAIT_LOAD;
        // @ts-expect-error - TS2339 - Property 'behaviorMsg' does not exist on type 'RecPopup'.
        this.behaviorMsg = "";
        // @ts-expect-error - TS2339 - Property 'autorun' does not exist on type 'RecPopup'.
        this.autorun = false;
      }
    Undefined Variable

    The variable 'defaultCollId' is used without being declared, which could cause runtime errors when handling sidepanel messages.

    defaultCollId = name;
    port.postMessage(await listAllMsg(collLoader, { defaultCollId }));
    Performance Concern

    The date formatting and grouping logic in the render method could be optimized. Currently, it processes all pages on each render and sorts them repeatedly.

    const groups = this.pages.reduce(
      (acc, page) => {
        const key = this._formatDate(new Date(Number(page.ts)));
        (acc[key] ||= []).push(page);
        return acc;
      },
      {} as Record<string, typeof this.pages>,
    );

    @yamijuan yamijuan merged commit e9cbbde into main May 7, 2025
    1 of 4 checks passed
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Projects

    None yet

    Development

    Successfully merging this pull request may close these issues.

    2 participants