Skip to content

vs-branch-6 #33

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

Merged
merged 22 commits into from
Apr 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
5e221da
✨ feat(css): optimize styles for better performance and maintainability
VatsalSy Apr 13, 2025
141d70f
🎨 Refine icon color styles for header navigation
VatsalSy Apr 13, 2025
b4b4e4c
✨ feat: Improve article image credit styling
VatsalSy Apr 13, 2025
645b40d
✨ feat(team): style social icons and GitHub icon in dark mode
VatsalSy Apr 13, 2025
7097bbe
✨ feat: Enhance social media icon styles and hover effects
VatsalSy Apr 13, 2025
d10a33c
🎨 feat(styles): Enhance tag styles for dark mode
VatsalSy Apr 13, 2025
58394c1
🎨 feat(research): Improve active tag styling and behavior
VatsalSy Apr 13, 2025
2adbf61
🔧 feat(platform-utils): Add platform detection and UI utilities
VatsalSy Apr 13, 2025
0f128e2
🎨 feat(styles): Update icon color to improve visibility
VatsalSy Apr 13, 2025
8d66e70
✨ feat: Enhance icon styling in header and footer
VatsalSy Apr 13, 2025
9b1a1d4
✨ feat(command-palette): improve dark mode styling
VatsalSy Apr 13, 2025
538bb52
✨ feat: Add keyboard shortcuts help command
VatsalSy Apr 13, 2025
6c8b306
🔧 refactor(platform-utils): extract platform detection and update logic
VatsalSy Apr 13, 2025
ed3c21a
✨ feat: Adjust social media icon colors in footer
VatsalSy Apr 13, 2025
e4879f0
📝 Add docstrings to `vs-branch-6`
coderabbitai[bot] Apr 13, 2025
86db16e
Update assets/css/command-palette.css
VatsalSy Apr 13, 2025
7c85c27
Update assets/css/command-palette.css
VatsalSy Apr 13, 2025
87f757b
Update assets/css/team.css
VatsalSy Apr 13, 2025
bd54fbf
Update assets/css/team.css
VatsalSy Apr 13, 2025
d2525b2
Merge pull request #34 from comphy-lab/coderabbitai/docstrings/ed3c21a
VatsalSy Apr 13, 2025
b46cfd7
✨ feat(css): add Google Scholar icon styles for team members
VatsalSy Apr 13, 2025
0563aa1
🎨 feat(styles): add newspaper icon color styles for light and dark th…
VatsalSy Apr 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/assets/js/shortcut-key.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
document.addEventListener('DOMContentLoaded', function() {
// Platform detection is now handled by platform-utils.js
/**
* Dynamically loads a stylesheet into the document's head.
*
* Creates a <link> element with the specified URL, sets attributes necessary for secure loading,
* and appends it to the document's head. If the stylesheet fails to load, an error is logged
* to the console.
*
* @param {string} href - The URL of the stylesheet to be loaded.
* @returns {HTMLLinkElement} The created and appended link element.
*/

function loadStylesheet(href) {
const link = document.createElement('link');
link.rel = 'stylesheet';
link.href = href;
link.crossOrigin = 'anonymous';
link.onerror = () => console.error(`Failed to load stylesheet: ${href}`);
document.head.appendChild(link);
return link;
}

const FA_VERSION = '6.7.2'; // Extract version to a constant for easier updates

loadStylesheet(`https://use.fontawesome.com/releases/v${FA_VERSION}/css/solid.css`);
loadStylesheet(`https://use.fontawesome.com/releases/v${FA_VERSION}/css/brands.css`);
loadStylesheet(`https://use.fontawesome.com/releases/v${FA_VERSION}/css/fontawesome.css`);
});
2 changes: 1 addition & 1 deletion News.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<a href="https://ammodo-science.webflow.io/researches/vatsal-sanjay" style="display: flex; align-items: center; text-decoration: none; color: #cf4900; font-size: 1em; font-weight: 500;"><i class="fa-solid fa-arrow-up-right-from-square" style="margin-right: 8px; font-size: 1.2em;"></i>Read More</a>
</div>
</div>
<div style="font-size: 0.75em; color: #666; margin-top: 5px; font-style: italic;">
<div style="font-size: 0.75em; color: var(--color-text); opacity: 0.7; margin-top: 5px; font-style: italic;">
Image credit: J. Heitman, B. J. Howlett, P. W. Crous, E. H. Stukenbrock, T. Y. James & N. A. R. Gow, The fungal kingdom, John Wiley & Sons (2020)
</div>
</div>
Expand Down
68 changes: 65 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@ A static website for the Computational Multiphase Physics Laboratory, built with
│ │ ├── research.css # Research page styles with dark mode support
│ │ ├── teaching.css # Teaching page styles with dark mode support
│ │ ├── team.css # Team page styles with dark mode support
│ │ ├── styles.css # Global styles with light/dark theme variables
│ │ ├── styles.css # Global styles with light/dark theme variables (optimized)
│ │ └── command-palette.css # Command palette styles (⌘K)
│ ├── js # JavaScript files
│ │ ├── main.js # Main JavaScript
│ │ ├── command-data.js # Command palette data and functionality
│ │ ├── shortcut-key.js # Platform detection for shortcuts
│ │ ├── platform-utils.js # Platform detection and UI utilities
│ │ ├── shortcut-key.js # Keyboard shortcut handling
│ │ └── search_db.json # Generated search database (used by command palette)
│ ├── favicon # Favicon files
│ └── img # Image assets
Expand Down Expand Up @@ -467,4 +468,65 @@ To submit a PR:
3. Test changes locally
4. Create a PR using the template
5. Link any related issues
6. Wait for review
6. Wait for review

### Code Style

#### General
- Use 2-space indentation across all files
- Follow DRY principles: reuse components, variables, and styles
- Add comments for complex logic, but keep code self-documenting

#### HTML/Markdown
- Use semantic HTML elements
- Follow BEM naming convention for CSS classes (e.g., `s-header__nav-list`)
- Keep content files in markdown format where possible

#### CSS
- Use CSS variables for colors and typography (defined in `:root`)
- Use responsive breakpoints at 1700px, 1300px, 900px, 768px, 500px
- Use `rem` units for font sizes and spacing
- Follow mobile-first approach for media queries
- Leverage CSS custom properties for theme switching
- Organize media queries by breakpoint for better maintainability
- Use standardized variable naming for consistent styling

#### JavaScript
- Use ES6+ features (arrow functions, const/let, template literals)
- Always include 'use strict' mode
- Use async/await for asynchronous operations
- Implement error handling with try/catch blocks
- Use camelCase for variable and function names
- Prefer event delegation for multiple similar elements

#### Images
- Optimize images for web (compress to reduce file size)
- Follow naming convention: `[name]-[descriptor].[extension]`
- Include alt text for all images

### CSS Architecture

The website's CSS has been optimized for better performance and maintainability:

1. **Variable System**
- Color variables for both light and dark themes
- Typography variables for consistent font sizing
- Spacing variables for layout consistency
- Shadow and transition presets for unified effects

2. **Consolidated Media Queries**
- Queries organized by breakpoint rather than by component
- Shared breakpoints at 1700px, 1300px, 1200px, 900px, 768px, and 500px
- Mobile-first approach throughout

3. **Optimized Dark Theme Support**
- CSS variables for seamless theme switching
- Fallback values for older browsers
- Theme-specific accent colors and contrasts
- Consistent text and background colors across components

4. **Performance Improvements**
- Reduced redundant selectors
- Consolidated duplicate styles
- Optimized transitions and animations
- Simplified box shadows for better rendering
35 changes: 17 additions & 18 deletions _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
<script defer src="/assets/js/main.js"></script>
<script defer src="/assets/js/command-data.js"></script>
<script defer src="/assets/js/platform-utils.js"></script>
<script defer src="/assets/js/shortcut-key.js"></script>

<script>
document.documentElement.classList.remove('no-js');
Expand Down Expand Up @@ -135,25 +137,22 @@
<script>
// Check if we're on localhost
if (window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1') {
// Load only specific Font Awesome icons for local development
var icons = ['github', 'search', 'arrow-up-right-from-square', 'bluesky', 'youtube', 'arrow-up'];
var link = document.createElement('link');
link.rel = 'stylesheet';
link.href = 'https://use.fontawesome.com/releases/v6.7.2/css/solid.css';
link.crossOrigin = 'anonymous';
document.head.appendChild(link);

var link2 = document.createElement('link');
link2.rel = 'stylesheet';
link2.href = 'https://use.fontawesome.com/releases/v6.7.2/css/brands.css';
link2.crossOrigin = 'anonymous';
document.head.appendChild(link2);
// Load Font Awesome stylesheets with improved error handling and version extraction
function loadStylesheet(href) {
const link = document.createElement('link');
link.rel = 'stylesheet';
link.href = href;
link.crossOrigin = 'anonymous';
link.onerror = () => console.error(`Failed to load stylesheet: ${href}`);
document.head.appendChild(link);
return link;
}

const FA_VERSION = '6.7.2'; // Extract version to a constant for easier updates

var link3 = document.createElement('link');
link3.rel = 'stylesheet';
link3.href = 'https://use.fontawesome.com/releases/v6.7.2/css/fontawesome.css';
link3.crossOrigin = 'anonymous';
document.head.appendChild(link3);
loadStylesheet(`https://use.fontawesome.com/releases/v${FA_VERSION}/css/solid.css`);
loadStylesheet(`https://use.fontawesome.com/releases/v${FA_VERSION}/css/brands.css`);
loadStylesheet(`https://use.fontawesome.com/releases/v${FA_VERSION}/css/fontawesome.css`);
} else {
// Use Kit for production with defer
var script = document.createElement('script');
Expand Down
60 changes: 39 additions & 21 deletions _layouts/research.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,27 @@
cursor: pointer;
transition: background-color 0.2s ease;
text-decoration: none;
color: inherit;
color: #333333;
}
[data-theme="dark"] tags span, [data-theme="dark"] tags a.tag-link {
background-color: #2a2a30;
color: #ffffff;
border: 1px solid rgba(111, 161, 255, 0.3);
}
tags span:hover, tags a.tag-link:hover {
background-color: #e0e0e0;
}
[data-theme="dark"] tags span:hover, [data-theme="dark"] tags a.tag-link:hover {
background-color: #3a3a40;
}
tags span.active, tags a.tag-link.active {
background-color: #007bff;
color: white;
}
[data-theme="dark"] tags span.active, [data-theme="dark"] tags a.tag-link.active {
background-color: #4d8dff;
color: white;
}
/* Style for filter notification */
.filter-note {
margin: 1rem 0;
Expand Down Expand Up @@ -152,6 +164,7 @@
<script defer src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
<script defer src="/assets/js/main.js"></script>
<script defer src="/assets/js/platform-utils.js"></script>
<script defer src="/assets/js/command-data.js"></script>
<script>
document.documentElement.classList.remove('no-js');
Expand Down Expand Up @@ -195,25 +208,22 @@
<script>
// Check if we're on localhost
if (window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1') {
// Load only specific Font Awesome icons for local development
var icons = ['github', 'search', 'arrow-up-right-from-square', 'bluesky', 'youtube', 'arrow-up'];
var link = document.createElement('link');
link.rel = 'stylesheet';
link.href = 'https://use.fontawesome.com/releases/v6.7.2/css/solid.css';
link.crossOrigin = 'anonymous';
document.head.appendChild(link);

var link2 = document.createElement('link');
link2.rel = 'stylesheet';
link2.href = 'https://use.fontawesome.com/releases/v6.7.2/css/brands.css';
link2.crossOrigin = 'anonymous';
document.head.appendChild(link2);
// Load Font Awesome stylesheets with improved error handling and version extraction
function loadStylesheet(href) {
const link = document.createElement('link');
link.rel = 'stylesheet';
link.href = href;
link.crossOrigin = 'anonymous';
link.onerror = () => console.error(`Failed to load stylesheet: ${href}`);
document.head.appendChild(link);
return link;
}

const FA_VERSION = '6.7.2'; // Extract version to a constant for easier updates

var link3 = document.createElement('link');
link3.rel = 'stylesheet';
link3.href = 'https://use.fontawesome.com/releases/v6.7.2/css/fontawesome.css';
link3.crossOrigin = 'anonymous';
document.head.appendChild(link3);
loadStylesheet(`https://use.fontawesome.com/releases/v${FA_VERSION}/css/solid.css`);
loadStylesheet(`https://use.fontawesome.com/releases/v${FA_VERSION}/css/brands.css`);
loadStylesheet(`https://use.fontawesome.com/releases/v${FA_VERSION}/css/fontawesome.css`);
} else {
// Use Kit for production with defer
var script = document.createElement('script');
Expand Down Expand Up @@ -516,7 +526,12 @@ <h3>Contents</h3>
const updateMatchingTags = (tagText, shouldHighlight) => {
document.querySelectorAll('tags span').forEach(tag => {
if (tag.textContent === tagText) {
tag.classList.toggle('active', shouldHighlight);
// First remove any active class
tag.classList.remove('active');
// Then add it back if needed
if (shouldHighlight) {
tag.classList.add('active');
}
}
});
};
Expand All @@ -529,7 +544,8 @@ <h3>Contents</h3>
// If clicking the active tag, deactivate it
if (activeTag === tagText) {
activeTag = null;
updateMatchingTags(tagText, false);
// Remove active class from all tags
allTags.forEach(t => t.classList.remove('active'));
paperContainers.forEach(container => {
container.classList.remove('hidden');
});
Expand All @@ -539,7 +555,9 @@ <h3>Contents</h3>

// Update active tag
activeTag = tagText;
// Remove active class from all tags
allTags.forEach(t => t.classList.remove('active'));
// Add active class to matching tags
updateMatchingTags(tagText, true);

// Update URL
Expand Down
34 changes: 16 additions & 18 deletions _layouts/teaching-course.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
<script defer src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
<script defer src="/assets/js/main.js"></script>
<script defer src="/assets/js/platform-utils.js"></script>
<script defer src="/assets/js/command-data.js"></script>

<!-- Theme toggle functionality -->
Expand Down Expand Up @@ -137,25 +138,22 @@
<script>
// Check if we're on localhost
if (window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1') {
// Load only specific Font Awesome icons for local development
var icons = ['github', 'search', 'arrow-up-right-from-square', 'bluesky', 'youtube', 'arrow-up', 'calendar-days', 'location-dot', 'clock'];
var link = document.createElement('link');
link.rel = 'stylesheet';
link.href = 'https://use.fontawesome.com/releases/v6.7.2/css/solid.css';
link.crossOrigin = 'anonymous';
document.head.appendChild(link);

var link2 = document.createElement('link');
link2.rel = 'stylesheet';
link2.href = 'https://use.fontawesome.com/releases/v6.7.2/css/brands.css';
link2.crossOrigin = 'anonymous';
document.head.appendChild(link2);
// Load Font Awesome stylesheets with improved error handling and version extraction
function loadStylesheet(href) {
const link = document.createElement('link');
link.rel = 'stylesheet';
link.href = href;
link.crossOrigin = 'anonymous';
link.onerror = () => console.error(`Failed to load stylesheet: ${href}`);
document.head.appendChild(link);
return link;
}

const FA_VERSION = '6.7.2'; // Extract version to a constant for easier updates

var link3 = document.createElement('link');
link3.rel = 'stylesheet';
link3.href = 'https://use.fontawesome.com/releases/v6.7.2/css/fontawesome.css';
link3.crossOrigin = 'anonymous';
document.head.appendChild(link3);
loadStylesheet(`https://use.fontawesome.com/releases/v${FA_VERSION}/css/solid.css`);
loadStylesheet(`https://use.fontawesome.com/releases/v${FA_VERSION}/css/brands.css`);
loadStylesheet(`https://use.fontawesome.com/releases/v${FA_VERSION}/css/fontawesome.css`);
} else {
// Use Kit for production with defer
var script = document.createElement('script');
Expand Down
Loading
Loading