feat: prepare project for cozy-ui migration (#157)

* feat: prepare project for cozy-ui migration

Build Configuration
- Add Stylus support via @rsbuild/plugin-stylus
- Add SVGR support via @rsbuild/plugin-svgr
- Update rsbuild.config.ts with custom configuration
- Add historyApiFallback for SPA routing

ESLint Configuration
- Create .eslintrc.json with react-app configuration
- Remove eslintConfig from package.json

CSS to Stylus Migration
Convert all 5 CSS files to Stylus (.styl) format:
  - src/App.css to src/App.styl
  - src/index.css to src/index.styl
  - src/components/Calendar/Calendar.css to src/components/Calendar/Calendar.styl
  - src/components/Calendar/CustomCalendar.css to src/components/Calendar/CustomCalendar.styl
  - src/components/Menubar/Menubar.css to src/components/Menubar/Menubar.styl
- Update all imports from .css to .styl
- Preserve all styling rules and values

MUI Styling Cleanup
- Replace all MUI sx props with standard style props across 15+ components
- Convert MUI spacing units (mr: 2 to marginRight: 16px)
- Convert MUI shorthand props (p: 2 to padding: 16px, mb: 1 to marginBottom: 8px)
- Remove MUI-specific syntax (&.Mui-checked selectors)
- Maintain exact visual appearance

FullCalendar Fixes
- Comment out problematic CSS rule in CustomCalendar.styl
- Fix display issues with timegrid slot labels

Files Modified
- Config: rsbuild.config.ts, .eslintrc.json, package.json
- Styling: 5 CSS to Stylus conversions, 15+ component sx to style updates
- Components: All components using MUI sx props updated

Development Workflow
- Continue using existing development commands
- Stylus files are now the source of truth for styling
- MUI components work with standard style props
- ESLint uses familiar react-app rules

Dependencies Added
- @rsbuild/plugin-stylus
- @rsbuild/plugin-svgr
This commit is contained in:
lenhanphung
2025-10-01 22:31:18 +07:00
committed by GitHub
parent 17c6bf7bce
commit 3870bceb6d
25 changed files with 1682 additions and 661 deletions
-155
View File
@@ -1,155 +0,0 @@
.App {
background-color: #f3f6f9;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.main-layout {
background-color: #fff;
flex-direction: row;
height: calc(100vh - 90px);
display: flex;
}
.calendar {
flex-grow: 1;
height: 100%;
overflow: hidden;
}
.calendarListHeader {
padding-top: 10px;
display: flex;
align-items: center;
margin-left: 25%;
}
.sidebar {
border-right: 2px solid #f3f4f6;
width: 330px;
padding: 16px 25px;
height: 90vh;
flex-direction: column;
overflow: auto;
}
.declined-event {
opacity: 0.7;
}
.needs-action-event {
opacity: 0.7;
border: dashed 1px #ffffff;
}
.fc-event-main span,
.fc-daygrid-event div {
display: block !important;
white-space: nowrap !important;
overflow: hidden !important;
text-overflow: ellipsis !important;
}
[data-theme="dark"] .fc-timegrid-slot::after {
border-top: 1px dotted rgba(255, 255, 255, 0.2);
}
#calendar {
flex: 1;
overflow: hidden; /* Important: let FullCalendar handle internal scroll */
}
/* Base container */
.fc-daygrid-day-top {
display: flex;
flex-direction: column;
align-items: center;
padding: 0.5rem 0;
font-family: "Inter", sans-serif;
}
/* sidebar*/
.sidebar-calendar {
width: 280px;
background-color: #fff;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
padding: 20px;
display: flex;
flex-direction: column;
gap: 30px;
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}
/* mini calendar style */
.react-calendar {
border: none;
font-size: 14px;
width: 100%;
user-select: none;
}
/* selected day hover */
.react-calendar__tile {
transition:
background-color 0.3s ease,
color 0.3s ease;
border: none;
background-color: white;
width: 12px;
height: 37.52px;
}
.react-calendar__tile--active {
background-color: rgb(255, 255, 255);
}
.today {
background: orange !important;
color: white;
}
.selectedWeek {
background-color: lightgrey;
}
.react-calendar__month-view__days__day--neighboringMonth {
color: gray;
}
/* sidebar header */
.sidebar-calendar h2 {
font-size: 1.3rem;
font-weight: 700;
color: #333;
margin: 0 0 10px 0;
}
/* Calendar list */
.calendar-list {
list-style: none;
padding: 0;
margin: 0;
display: flex;
flex-direction: column;
gap: 15px;
}
.calendar-list li {
display: flex;
align-items: center;
gap: 10px;
font-weight: 600;
color: #444;
padding: 10px 15px;
border-radius: 10px;
transition: background-color 0.2s ease;
cursor: pointer;
}
.event-dot {
margin-top: 2px;
width: 6px;
height: 6px;
background-color: #d93025;
border-radius: 50%;
margin-left: auto;
margin-right: auto;
}
+135
View File
@@ -0,0 +1,135 @@
.App
background-color #f3f6f9
display flex
flex-direction column
justify-content space-between
.main-layout
background-color #fff
flex-direction row
height calc(100vh - 90px)
display flex
.calendar
flex-grow 1
height 100%
overflow hidden
.calendarListHeader
padding-top 10px
display flex
align-items center
margin-left 25%
.sidebar
border-right 2px solid #f3f4f6
width 330px
padding 16px 25px
height 90vh
flex-direction column
overflow auto
.declined-event
opacity 0.7
.needs-action-event
opacity 0.7
border dashed 1px #ffffff
.fc-event-main span,
.fc-daygrid-event div
display block !important
white-space nowrap !important
overflow hidden !important
text-overflow ellipsis !important
[data-theme="dark"] .fc-timegrid-slot::after
border-top 1px dotted rgba(255, 255, 255, 0.2)
#calendar
flex 1
overflow hidden /* Important: let FullCalendar handle internal scroll */
/* Base container */
.fc-daygrid-day-top
display flex
flex-direction column
align-items center
padding 0.5rem 0
font-family "Inter", sans-serif
/* sidebar*/
.sidebar-calendar
width 280px
background-color #fff
border-radius 12px
box-shadow 0 4px 12px rgba(0, 0, 0, 0.1)
padding 20px
display flex
flex-direction column
gap 30px
font-family "Segoe UI", Tahoma, Geneva, Verdana, sans-serif
/* mini calendar style */
.react-calendar
border none
font-size 14px
width 100%
user-select none
/* selected day hover */
.react-calendar__tile
transition background-color 0.3s ease, color 0.3s ease
border none
background-color white
width 12px
height 37.52px
.react-calendar__tile--active
background-color rgb(255, 255, 255)
.today
background orange !important
color white
.selectedWeek
background-color lightgrey
.react-calendar__month-view__days__day--neighboringMonth
color gray
/* sidebar header */
.sidebar-calendar h2
font-size 1.3rem
font-weight 700
color #333
margin 0 0 10px 0
/* Calendar list */
.calendar-list
list-style none
padding 0
margin 0
display flex
flex-direction column
gap 15px
.calendar-list li
display flex
align-items center
gap 10px
font-weight 600
color #444
padding 10px 15px
border-radius 10px
transition background-color 0.2s ease
cursor pointer
.event-dot
margin-top 2px
width 6px
height 6px
background-color #d93025
border-radius 50%
margin-left auto
margin-right auto
+2 -2
View File
@@ -4,8 +4,8 @@ import timeGridPlugin from "@fullcalendar/timegrid";
import interactionPlugin from "@fullcalendar/interaction";
import { CalendarApi, DateSelectArg } from "@fullcalendar/core";
import ReactCalendar from "react-calendar";
import "./Calendar.css";
import "./CustomCalendar.css";
import "./Calendar.styl";
import "./CustomCalendar.styl";
import { useEffect, useRef, useState } from "react";
import { useAppDispatch, useAppSelector } from "../../app/hooks";
import EventPopover from "../../features/Events/EventModal";
@@ -19,11 +19,11 @@ export function ColorPicker({
role="button"
aria-label={`select color ${c}`}
onClick={() => onChange(c)}
sx={{
style={{
width: 20,
height: 20,
borderRadius: "50%",
bgcolor: c,
backgroundColor: c,
cursor: "pointer",
border:
selectedColor === c ? "2px solid black" : "2px solid transparent",
+17 -14
View File
@@ -44,18 +44,18 @@ function CalendarItem({
display="flex"
alignItems="center"
justifyContent="space-between"
sx={{
borderRadius: 2,
style={{
borderRadius: 8,
border: "1px solid #e5e7eb",
p: 1,
mb: 1,
padding: 8,
marginBottom: 8,
}}
>
<Box display="flex" alignItems="center" gap={2}>
<Avatar
src={cal.owner.avatarUrl}
alt={cal.owner.email}
sx={{
style={{
border: `2px solid ${cal.cal["apple:color"] ?? "transparent"}`,
boxShadow: cal.cal["apple:color"]
? `0 0 0 2px ${cal.cal["apple:color"]}`
@@ -228,7 +228,7 @@ export default function CalendarSearch({
}}
>
<Box
sx={{
style={{
position: "absolute",
left: "50%",
top: "20%",
@@ -238,16 +238,16 @@ export default function CalendarSearch({
}}
>
<Card
sx={{
p: 2,
borderRadius: 3,
boxShadow: 6,
style={{
padding: 16,
borderRadius: 12,
boxShadow: "0 4px 12px rgba(0,0,0,0.15)",
display: "flex",
flexDirection: "column",
maxHeight: "80vh",
}}
>
<Box sx={{ position: "absolute", top: 8, right: 8 }}>
<Box style={{ position: "absolute", top: 8, right: 8 }}>
<IconButton
size="small"
onClick={() => onClose({}, "backdropClick")}
@@ -256,8 +256,11 @@ export default function CalendarSearch({
</IconButton>
</Box>
<CardHeader title="Browse other calendars" sx={{ pb: 0 }} />
<CardContent sx={{ flex: 1, overflow: "auto" }}>
<CardHeader
title="Browse other calendars"
style={{ paddingBottom: 0 }}
/>
<CardContent style={{ flex: 1, overflow: "auto" }}>
<PeopleSearch
objectTypes={["user"]}
selectedUsers={selectedUsers}
@@ -319,7 +322,7 @@ export default function CalendarSearch({
/>
</CardContent>
<CardActions sx={{ justifyContent: "flex-end", gap: 1 }}>
<CardActions style={{ justifyContent: "flex-end", gap: 8 }}>
<Button
variant="outlined"
onClick={() => onClose({}, "backdropClick")}
@@ -8,6 +8,8 @@ import { useState } from "react";
import CalendarPopover from "./CalendarModal";
import { Calendars } from "../../features/Calendars/CalendarTypes";
import MoreVertIcon from "@mui/icons-material/MoreVert";
import ArrowDropDownIcon from "@mui/icons-material/ArrowDropDown";
import CalendarSearch from "./CalendarSearch";
import IconButton from "@mui/material/IconButton";
import Checkbox from "@mui/material/Checkbox";
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
-238
View File
@@ -1,238 +0,0 @@
/* Custom main calendar view */
.fc-theme-standard td,
.fc-theme-standard th {
border: 1px solid #b8c1cc;
}
th.fc-col-header-cell.fc-day {
border-left: 0;
}
a.fc-timegrid-axis-cushion {
color: #243b55;
text-align: center;
font-family: Roboto;
font-size: 12.507px;
font-style: normal;
font-weight: 400;
line-height: 18.76px;
letter-spacing: 0.391px;
}
/* Slot label visibility transitions */
.fc-timegrid-slot-label {
transition: opacity 0.3s ease-in-out;
}
.fc-daygrid-day-top small {
color: #8c9caf;
font-size: 14px;
font-style: normal;
font-weight: 500;
line-height: 20px;
letter-spacing: 0.25px;
font-family: "Inter", sans-serif;
}
.fc-daygrid-day-top .fc-daygrid-day-number,
span.fc-daygrid-day-number {
color: #243b55;
margin: 0 6px 0 0;
font-family: Roboto;
font-size: 28px;
font-style: normal;
font-weight: 400;
line-height: 36px;
position: relative;
width: 48px;
height: 48px;
line-height: 39px;
}
.fc-daygrid-day-top .fc-daygrid-day-number:after,
span.fc-daygrid-day-number:after {
content: "";
z-index: -1;
border-radius: 50%;
width: 45px;
height: 45px;
position: absolute;
top: 1px;
left: 1px;
transition: background-color 0.3s ease;
}
span.fc-daygrid-day-number.current-date {
color: #fff;
}
span.fc-daygrid-day-number.current-date:after {
background-color: #f67e35;
}
td.fc-timegrid-slot.fc-timegrid-slot-label.fc-scrollgrid-shrink,
td.fc-timegrid-slot.fc-timegrid-slot-label.fc-timegrid-slot-minor {
border: 0;
}
th.fc-timegrid-axis.fc-scrollgrid-shrink {
border: 0;
border-right: 1px solid #b8c1cc;
}
.fc .fc-timegrid-axis-cushion {
min-width: 80px;
max-width: 80px;
padding: 0;
text-align: left;
font-family: Roboto;
font-size: 12.507px;
font-style: normal;
font-weight: 400;
line-height: 18.76px;
padding: 0 0 0 10px;
}
.fc .fc-timegrid-divider {
display: none;
height: 0;
}
.fc-timegrid-slot-label-cushion {
color: #aea9b1;
font-family: Roboto;
font-size: 14px;
font-style: normal;
font-weight: 400;
line-height: 20px;
letter-spacing: 0.25px;
}
th.fc-col-header-cell.fc-day {
border-right: 0;
border-bottom: 0;
}
.fc .fc-scrollgrid {
border: 0;
}
.fc .fc-timegrid-slot-label {
justify-content: flex-end;
}
.fc .fc-timegrid-slot-label .fc-timegrid-slot-label-frame {
position: relative;
transform: translate(-15px, -12px);
}
.fc
tbody
tr:first-of-type
.fc-timegrid-slot-label
.fc-timegrid-slot-label-frame {
display: none;
}
.fc .fc-timegrid-slot-label .fc-timegrid-slot-label-frame::after {
content: "";
z-index: -1;
background-color: #b8c1cc;
width: 10px;
height: 1px;
position: absolute;
top: 9.5px;
right: -15px;
}
.fc .fc-timegrid-col.fc-day-today,
.fc .fc-daygrid-day.fc-day-today {
background-color: #fff;
}
.fc .fc-daygrid-body-unbalanced .fc-daygrid-day-events {
min-height: 36px;
}
.fc .fc-daygrid-body-natural .fc-daygrid-day-events {
margin-bottom: 0;
}
.fc .fc-timegrid-now-indicator-line {
z-index: 5;
border: 0 solid #f67e35;
border-top-width: 2px;
position: absolute;
left: 0;
right: 0;
}
.fc .fc-timegrid-now-indicator-line::after {
content: "";
z-index: 5;
background-color: #f67e35;
border-radius: 50%;
width: 10px;
height: 10px;
position: absolute;
top: -6px;
left: -5px;
}
.fc .fc-timegrid-now-indicator-arrow {
display: block !important;
width: auto;
height: auto;
position: relative;
border: 0;
}
.fc .fc-timegrid-now-indicator-arrow::before {
content: attr(data-time);
color: #f67e35;
white-space: nowrap;
font-family: Roboto, sans-serif;
font-weight: 600;
position: absolute;
top: -2px;
left: 25px;
font-size: 14px;
letter-spacing: 0.25px;
}
.fc-day-today .fc-timegrid-now-indicator-container {
overflow: unset;
}
.fc .fc-timegrid-slot {
height: auto;
min-height: 20px !important;
}
.fc .fc-timegrid-slot-label {
display: flex;
align-items: flex-start;
padding-top: 2px;
height: 100%;
}
tr:has(> td.fc-timegrid-divider.fc-cell-shaded) {
display: none;
}
.fc .fc-scrollgrid-section td {
border-bottom: 0;
}
.fc .fc-scrollgrid-section td .fc-daygrid-day-frame {
border-bottom: 1px solid #b8c1cc;
}
th.fc-col-header-cell.fc-day {
cursor: pointer;
}
th.fc-col-header-cell.fc-day:hover
.fc-daygrid-day-number:not(.current-date)::after {
background-color: #b8c1cc56;
}
/* Hover effects for month view using CSS */
.fc-daygrid-day:hover {
background-color: #b8c1cc1a !important;
transition: background-color 0.3s ease;
}
/* Hover effects for week and day views using JavaScript */
.hoverable-day-cell {
transition: background-color 0.3s ease;
}
.hour-highlight {
transition: background-color 0.3s ease;
background-color: #b8c1cc1a !important;
position: absolute;
left: 0;
right: 0;
pointer-events: none;
z-index: 1;
}
.fc-timegrid-slot-label {
background-color: #fff !important;
}
thead .fc-scroller,
tbody > tr.fc-scrollgrid-section:first-of-type .fc-scroller {
overflow: hidden !important;
}
.navigation-controls {
margin-right: 40px;
}
+226
View File
@@ -0,0 +1,226 @@
/* Custom main calendar view */
.fc-theme-standard td,
.fc-theme-standard th
border 1px solid #b8c1cc
th.fc-col-header-cell.fc-day
border-left 0
a.fc-timegrid-axis-cushion
color #243b55
text-align center
font-family Roboto
font-size 12.507px
font-style normal
font-weight 400
line-height 18.76px
letter-spacing 0.391px
/* Slot label visibility transitions */
.fc-timegrid-slot-label
transition opacity 0.3s ease-in-out
.fc-daygrid-day-top small
color #8c9caf
font-size 14px
font-style normal
font-weight 500
line-height 20px
letter-spacing 0.25px
font-family "Inter", sans-serif
.fc-daygrid-day-top .fc-daygrid-day-number,
span.fc-daygrid-day-number
color #243b55
margin 0 6px 0 0
font-family Roboto
font-size 28px
font-style normal
font-weight 400
line-height 36px
position relative
width 48px
height 48px
line-height 39px
.fc-daygrid-day-top .fc-daygrid-day-number:after,
span.fc-daygrid-day-number:after
content ""
z-index -1
border-radius 50%
width 45px
height 45px
position absolute
top 1px
left 1px
transition background-color 0.3s ease
span.fc-daygrid-day-number.current-date
color #fff
span.fc-daygrid-day-number.current-date:after
background-color #f67e35
td.fc-timegrid-slot.fc-timegrid-slot-label.fc-scrollgrid-shrink,
td.fc-timegrid-slot.fc-timegrid-slot-label.fc-timegrid-slot-minor
border 0
th.fc-timegrid-axis.fc-scrollgrid-shrink
border 0
border-right 1px solid #b8c1cc
.fc .fc-timegrid-axis-cushion
min-width 80px
max-width 80px
padding 0
text-align left
font-family Roboto
font-size 12.507px
font-style normal
font-weight 400
line-height 18.76px
padding 0 0 0 10px
.fc .fc-timegrid-divider
display none
height 0
.fc-timegrid-slot-label-cushion
color #aea9b1
font-family Roboto
font-size 14px
font-style normal
font-weight 400
line-height 20px
letter-spacing 0.25px
th.fc-col-header-cell.fc-day
border-right 0
border-bottom 0
.fc .fc-scrollgrid
border 0
.fc .fc-timegrid-slot-label
justify-content flex-end
.fc .fc-timegrid-slot-label .fc-timegrid-slot-label-frame
position relative
transform translate(-15px, -12px)
/* .fc tbody tr:first-of-type .fc-timegrid-slot-label .fc-timegrid-slot-label-frame
display none */
.fc .fc-timegrid-slot-label .fc-timegrid-slot-label-frame::after
content ""
z-index -1
background-color #b8c1cc
width 10px
height 1px
position absolute
top 9.5px
right -15px
.fc .fc-timegrid-col.fc-day-today,
.fc .fc-daygrid-day.fc-day-today
background-color #fff
.fc .fc-daygrid-body-unbalanced .fc-daygrid-day-events
min-height 36px
.fc .fc-daygrid-body-natural .fc-daygrid-day-events
margin-bottom 0
.fc .fc-timegrid-now-indicator-line
z-index 5
border 0 solid #f67e35
border-top-width 2px
position absolute
left 0
right 0
.fc .fc-timegrid-now-indicator-line::after
content ""
z-index 5
background-color #f67e35
border-radius 50%
width 10px
height 10px
position absolute
top -6px
left -5px
.fc .fc-timegrid-now-indicator-arrow
display block !important
width auto
height auto
position relative
border 0
.fc .fc-timegrid-now-indicator-arrow::before
content attr(data-time)
color #f67e35
white-space nowrap
font-family Roboto, sans-serif
font-weight 600
position absolute
top -2px
left 25px
font-size 14px
letter-spacing 0.25px
.fc-day-today .fc-timegrid-now-indicator-container
overflow unset
.fc .fc-timegrid-slot
height auto
min-height 20px !important
.fc .fc-timegrid-slot-label
display flex
align-items flex-start
padding-top 2px
height 100%
tr:has(> td.fc-timegrid-divider.fc-cell-shaded)
display none
.fc .fc-scrollgrid-section td
border-bottom 0
.fc .fc-scrollgrid-section td .fc-daygrid-day-frame
border-bottom 1px solid #b8c1cc
th.fc-col-header-cell.fc-day
cursor pointer
th.fc-col-header-cell.fc-day:hover .fc-daygrid-day-number:not(.current-date)::after
background-color #b8c1cc56
/* Hover effects for month view using CSS */
.fc-daygrid-day:hover
background-color #b8c1cc1a !important
transition background-color 0.3s ease
/* Hover effects for week and day views using JavaScript */
.hoverable-day-cell
transition background-color 0.3s ease
.hour-highlight
transition background-color 0.3s ease
background-color #b8c1cc1a !important
position absolute
left 0
right 0
pointer-events none
z-index 1
.fc-timegrid-slot-label
background-color #fff !important
thead .fc-scroller,
tbody > tr.fc-scrollgrid-section:first-of-type .fc-scroller
overflow hidden !important
.navigation-controls
margin-right 40px