Skip to content

Refactor#52

Open
ujain1999 wants to merge 9 commits intomainfrom
refactor
Open

Refactor#52
ujain1999 wants to merge 9 commits intomainfrom
refactor

Conversation

@ujain1999
Copy link
Copy Markdown
Owner

@ujain1999 ujain1999 commented Dec 18, 2025

Tasks for the main new-tab page.

  • For the main new tab page - separate the functionality and styling for each component into the respective files in the components directory.

    • Clock
    • Weather
    • Top Right Shortcuts
    • Bookmarks
    • Sidebar
    • Unsplash/Custom Background Image
    • Customise button
    • Theme toggle
  • For the options page - separate the styling into options.css*

*I plan on doing a refactor for the options page once this is finished.

Initially I was planning to rewrite the whole thing in React but that seems to be too time consuming and also feels a bit extra for a simple chrome extension like this so I decided against that. Vanilla JS it is, for now, at least.

@ujain1999 ujain1999 linked an issue Dec 18, 2025 that may be closed by this pull request
@BaldrianSector
Copy link
Copy Markdown
Collaborator

Good choices here. I'll gladly review and test it, when you feel like it is ready for a new set of eyes.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I would suggest to call top-right module "Shortcuts" like in the options menu. We might want to make it possible to change the position of it at a later point in time, so naming should be unrelated of current styling. I understand that we in options refer to it by "Show Top-Right Shortcuts", but I think calling it Shortcuts in the code makes it easier to understand what it represents.

Copy link
Copy Markdown
Collaborator

@BaldrianSector BaldrianSector Dec 18, 2025

Choose a reason for hiding this comment

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

Same for this as this comment

@BaldrianSector
Copy link
Copy Markdown
Collaborator

Really good work so far 👍🏻

A lot clearer what parts of the codes does what. Consider adding individual pages for the Options, so it becomes easier to add new ones. But think .css styling could be applied for the whole settings window as it is now.

@ujain1999 ujain1999 marked this pull request as ready for review January 16, 2026 13:33
@BaldrianSector
Copy link
Copy Markdown
Collaborator

I would expect a bit more organization in terms of folder structure.

Could be something like this:

 - src/ is the source tree:
      - src/pages/newtab/ → new tab entry point (index.html, main.js, style.css, art.js)
      - src/pages/options/ → options UI (options.html, options.js, options.css)
      - src/components/ → reusable UI modules (JS + CSS per feature: clock, weather, bookmarks, topRight, sidebar, unsplash)
      - src/widgets/ → standalone widgets (calendar, todo)
      - src/shared/ → shared globals (defaultSettings.js, utils.js)
      - src/assets/ → static assets (favicons, webmanifest)
Structure

Not sure how it fits together with the minify, but consider if this can be improved.

@BaldrianSector
Copy link
Copy Markdown
Collaborator

After refactor I get a FOUC like this:

image

Should look at when styling is applied to loaded content.

@BaldrianSector
Copy link
Copy Markdown
Collaborator

BaldrianSector commented Jan 17, 2026

Consider splitting sidebar widgets into separately files. Currently both calendar and todo lives inside of sidebar, at least for .css styling. For scalability (if we want to add more widgets later on), I think it would be nice if they were handled separately.

```

**Requirements:** [uv](https://docs.astral.sh/uv/) (fast Python package manager)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should include simple guide for installation
brew install uv

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I feel like this can be improved for the guide of how to setup.

I got the following issues when setting it up:

  1. Not having a guide til install UV
  2. Not running python, but using python3
  3. Using python build.py prod from installation guide and not having python build.py dev in the Dev Setup guide
  4. Needing to activate .venv to be able to auto-watch
I installed the deps into the .venv that uv sync created, but I was running the system python3, so it can’t see watchdog.

  I had to run the build through the venv:

  - uv run python build.py dev
  - or ./.venv/bin/python build.py dev
  - or source .venv/bin/activate then python build.py dev

python build.py prod
```

Then load the `dist/prod` folder as an unpacked extension in Chrome.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I just loaded the root folder for minimal_newtab and seemed to have no issues. Is this line correct?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Understand now, that both will work, but running from the dist/prod will serve a much smaller project. I was a bit unclear to me.

uv sync # Install dependencies with uv
```

**Requirements:** [uv](https://docs.astral.sh/uv/) (fast Python package manager)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Move requirements before setup

Comment on lines +144 to +192
/* Ensure both About icons (webstore + github) visually match the official badge size */
.about-links { gap: 12px; }

/* Make both icons look like they're part of the page: no heavy borders, same size as chrome badge */
.about-links .icon-link {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 6px 8px;
width: auto;
height: auto;
background: transparent; /* blend with page */
border: 1px solid rgba(255,255,255,0.14); /* white-ish border for dark mode */
border-radius: 6px;
transition: transform 0.08s ease, opacity 0.12s ease;
}

.about-links .icon-link img {
height: 36px; /* official badge height */
width: auto;
display: block;
}

.about-links .icon-link:hover {
transform: translateY(-2px);
opacity: 0.95;
}

/* Light theme: use darker (black) border so icons stand out */
body.light .about-links .icon-link {
border: 1px solid rgba(0,0,0,0.16);
}

.widget {
background: rgba(0, 0, 0, 0.25);
border-radius: 8px;
padding: 15px;
margin-bottom: 15px;
}

body.light .widget {
background: rgba(0, 0, 0, 0.05);
}

.widget h3 {
margin-top: 0;
border-bottom: 1px solid rgba(128, 128, 128, 0.3);
padding-bottom: 10px;
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This belongs in the Options.css

Comment on lines +1 to +22
.shortcuts {
display: flex;
flex-direction: column;
align-items: flex-start;
max-width: 800px;
width: 100%;
font-size: 1.1rem;
text-align: left;
margin-left: 4rem;
max-height: calc(100vh - 18rem);
overflow-y: auto;
overflow-x: hidden;
padding-right: 1rem;
padding-bottom: 12rem;
-webkit-overflow-scrolling: touch;
overscroll-behavior: contain;
scrollbar-width: none; /* Hide scrollbar in Firefox */
}

.shortcuts::-webkit-scrollbar {
display: none; /* Hide scrollbar in WebKit browsers */
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is there a reason for this not to be .bookmarks?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Code is spaghetti 🍝

2 participants