Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html lang="he" dir="rtl">
<html lang="en" dir="ltr">

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Look for runtime root-attribute sync on language changes.
rg -n "document\\.documentElement\\.(dir|lang)|setAttribute\\(['\"](dir|lang)|i18n\\.on\\(['\"]languageChanged" --type=ts --type=tsx --type=js src

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 107


🏁 Script executed:

#!/bin/bash
# Check available file types and search for language switching logic
echo "=== Searching for language switching logic ==="
rg -n "document\.documentElement\.(dir|lang)|setAttribute.*(?:dir|lang)|languageChanged|language.*change" src --max-count=20

echo -e "\n=== Checking for i18n configuration ==="
fd -e js -e ts -e json src | xargs grep -l "i18n\|language" | head -10

echo -e "\n=== List files in src ==="
find src -type f \( -name "*.js" -o -name "*.ts" -o -name "*.json" -o -name "*.html" \) | head -20

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 1023


🏁 Script executed:

#!/bin/bash
# Look more broadly for language/direction handling
rg -n "lang|dir|hebrew|arabic" src --type-list | grep "type:"

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 469


🏁 Script executed:

#!/bin/bash
# Search for any language switching mechanism
rg -i "setlanguage|changelanguage|selectlanguage|language.*switch" src

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 564


🏁 Script executed:

#!/bin/bash
# Check the i18n configuration and see if it already updates document attributes
rg -n "document\.documentElement" src

echo -e "\n=== Full changeLanguage implementation in App.tsx ==="
rg -B5 -A10 "changeLanguage" src/App.tsx | head -40

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 1317


🏁 Script executed:

#!/bin/bash
# Look for i18n setup and configuration
find src -name "*i18n*" -o -name "*locali*" | head -10

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 91


🏁 Script executed:

#!/bin/bash
# Check index.html for current state
cat index.html

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 456


🏁 Script executed:

#!/bin/bash
# Read the i18n configuration file
cat src/i18n.ts

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 745


Update document root lang and dir attributes when language changes.

The changeLanguage() function in App.tsx calls i18n.changeLanguage(lng) but does not update document.documentElement.lang and document.documentElement.dir. When switching to Hebrew or Arabic, the root element remains lang="en" dir="ltr", breaking RTL layout and accessibility. Add a listener to update these attributes on language changes (e.g., i18n.on('languageChanged', (lng) => { document.documentElement.lang = lng; document.documentElement.dir = lng === 'ar' || lng === 'he' ? 'rtl' : 'ltr'; })).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@index.html` at line 2, In the changeLanguage() function in App.tsx, after
calling i18n.changeLanguage(lng), add a listener to the i18n object that updates
the document root attributes whenever the language changes. Specifically, listen
for the 'languageChanged' event and update document.documentElement.lang to the
new language code, and set document.documentElement.dir to 'rtl' for RTL
languages (Arabic and Hebrew) or 'ltr' for other languages. This ensures the
HTML root element reflects the current language settings, properly supporting
RTL layouts and accessibility when switching between languages.

<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
Expand Down
1 change: 0 additions & 1 deletion src/components/NavBar/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { theme } from '../../theme'
export const desktopNav: CSSProperties = {
position: 'fixed',
top: 0,
right: 0,
height: '100%',
width: '20%',
display: 'flex',
Expand Down
8 changes: 5 additions & 3 deletions src/components/UI/Slider/SGLSlider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,21 @@ import { Slider } from '@mui/material'
import { sliderStyles } from './styles'
import type { CSSProperties } from 'react'
import { type SliderProps as MuiSliderProps } from '@mui/material'
import { useDirection } from '@/hooks/useDirection'

interface sliderProps extends Omit<MuiSliderProps, 'onChange'> {
onChange: (value: number) => void
style?: CSSProperties
Comment on lines 7 to 9

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

fd -t f "SGLSlider.tsx" --exec cat -n {} \;

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 909


🏁 Script executed:

# Check MUI Slider props definition to confirm range mode support
rg "SliderProps" --type ts --type tsx -A 5 -B 2 | head -50

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 107


🏁 Script executed:

# Search for usages of SGLSlider to see if range mode is ever attempted
rg "SGLSlider" --type ts --type tsx -A 3 -B 2

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 107


🌐 Web query:

MUI Slider component value prop number array range mode type definition

💡 Result:

In the Material UI (MUI) Slider component, the value prop accepts either a number or an array of numbers, depending on whether you are implementing a single-value slider or a range slider [1][2]. Type Definition and Usage: - Single-value mode: The value prop expects a number [1][3]. - Range mode: To enable range selection, provide an array containing exactly two numbers (e.g., [start, end]) to the value prop [1][4][2]. When using the component with TypeScript, the value is typically represented as number or number[] [3][5]. For range sliders, the component manages two thumbs corresponding to the two values in the array [4][6]. Key Implementation Details: - onChange handler: When the slider's value changes, the onChange callback receives the event and the new value. For range sliders, the second argument (the value) will be an array of numbers (e.g., number[] or readonly number[]) [3][2]. - Minimum Distance: When using a range slider, you can manage the spacing between the two thumbs using the disableSwap prop or by handling the activeThumb parameter provided in the onChange callback [4][6]. The Slider component automatically detects that it should operate in range mode when an array is provided to the value or defaultValue prop [4][2].

Citations:


🏁 Script executed:

# Search for SGLSlider usages without explicit file type filtering
rg "SGLSlider" -A 3 -B 2

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 2044


🏁 Script executed:

# Check how SliderProps is imported and what it provides
rg "SliderProps as MuiSliderProps" -A 5

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 550


onChange typing conflicts with inherited Slider range mode.

The interface extends MuiSliderProps but only removes onChange, leaving value and defaultValue as number | number[]. However, the custom onChange callback accepts only number. At line 19, value as number masks this contract mismatch. Either explicitly narrow the interface to single-value mode or handle both number and number[] safely.

Suggested patch (enforce single-value contract)
-interface sliderProps extends Omit<MuiSliderProps, 'onChange'> {
+interface sliderProps extends Omit<MuiSliderProps, 'onChange' | 'value' | 'defaultValue'> {
+  value?: number
+  defaultValue?: number
   onChange: (value: number) => void
   style?: CSSProperties
 }
@@
-      onChange={(_, value) => onChange(value as number)}
+      onChange={(_, value) => {
+        if (typeof value === 'number') onChange(value)
+      }}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/UI/Slider/SGLSlider.tsx` around lines 7 - 9, The sliderProps
interface in SGLSlider.tsx has a typing conflict where it inherits value and
defaultValue properties from MuiSliderProps (which can be number or number[])
but defines onChange to only accept a single number parameter. To enforce a
single-value contract, expand the Omit statement to also exclude the value and
defaultValue properties from MuiSliderProps in addition to onChange, then remove
the type assertion "as number" at line 19 where value is used. This ensures the
interface accurately represents a single-value slider and eliminates the type
mismatch between the props and the onChange callback signature.

}

export const SGLSlider = ({ onChange, style, ...props }: sliderProps) => {
const isRtl = useDirection()
return (
<Slider
dir="lyr"
sx={(theme) => ({ ...sliderStyles(theme), ...style })}
onChange={(_, value) => onChange(value as number)}
{...props}
dir={isRtl ? 'rtl' : 'ltr'}
sx={(theme) => ({ ...sliderStyles(theme, isRtl), ...style })}
onChange={(_, value) => onChange(value as number)}
/>
)
}
4 changes: 3 additions & 1 deletion src/components/UI/Slider/styles.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
import type { Theme } from '@mui/material/styles'

export const sliderStyles = (theme: Theme) => ({
export const sliderStyles = (theme: Theme, isRtl: boolean) => ({
'& .MuiSlider-thumb': {
marginInline: '-1rem',
backgroundColor: theme.palette.purple.main,
border: `2.5px solid ${theme.palette.background.paper}`,
boxShadow: theme.shadows[1],
},
'& .MuiSlider-track': {
direction: isRtl ? 'rtl' : 'ltr',
backgroundColor: 'transparent',
border: 'none',
height: '0.3rem',
},
'& .MuiSlider-rail': {
direction: isRtl ? 'rtl' : 'ltr',
color: theme.palette.mediumGrey.main,
height: '0.3rem',
},
Expand Down
7 changes: 7 additions & 0 deletions src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ export const SLIDER_MIN_VALUE = 1
export const SLIDER_MAX_VALUE = 10
export const BALANCE_VIDEO_TIME = 15
export const STRETCH_VIDEO_TIME = 10
export const LUNGUAGES = {
Hebrew: 'he',
English: 'en',
Arabic: 'ar',
Russian: 'ru',
}
export const RTL_LUNGUAGES = [LUNGUAGES.Hebrew, LUNGUAGES.Arabic]
export const MOCK_DATA = {
patientID: Number('1622017'),
date: formatIsoDate(new Date(2026, 5, 23)),
Expand Down
9 changes: 9 additions & 0 deletions src/hooks/useDirection.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { useTranslation } from 'react-i18next'
import { RTL_LUNGUAGES } from '../constants'

export const useDirection = () => {
const { i18n } = useTranslation()

const isRtl = RTL_LUNGUAGES.includes(i18n.language)
return isRtl
}
2 changes: 1 addition & 1 deletion src/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const resources = {

i18n.use(initReactI18next).init({
resources,
lng: 'he',
lng: 'en',
fallbackLng: 'en',
Comment on lines +26 to 27

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify direction source-of-truth and runtime synchronization points.
rg -n "createTheme\\(|direction\\s*:" --type=ts --type=tsx src
rg -n "ThemeProvider|document\\.documentElement\\.(dir|lang)|setAttribute\\(['\"](dir|lang)|languageChanged" --type=ts --type=tsx src

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 135


🏁 Script executed:

cd src && ls -la *.ts 2>/dev/null | head -20

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 254


🏁 Script executed:

cat -n src/i18n.ts

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 976


🏁 Script executed:

cat -n src/theme.ts

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 3648


🏁 Script executed:

rg -n "direction|lng|createTheme" src --max-count=50

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 515


🏁 Script executed:

rg -n "ThemeProvider|useTranslation|i18next|useEffect.*direction|useEffect.*lng" src --max-count=50

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 10561


🏁 Script executed:

cat -n src/main.tsx | head -60

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 2311


🏁 Script executed:

cat -n src/App.tsx

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 2845


🏁 Script executed:

rg -n "useMemo|useEffect|createTheme" src/main.tsx src/App.tsx --max-count=20

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 61


🏁 Script executed:

rg -n "theme.*=|setTheme|useTheme" src --max-count=30

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 6892


Update theme direction when language changes to prevent RTL rendering in LTR locales.

With lng: 'en' in i18n.ts (line 26) but direction: 'rtl' hardcoded in theme.ts, the MUI theme will always render RTL regardless of language. When users switch to English or Russian, components still receive the RTL theme, causing layout misalignment and broken localization.

Pass the current language direction to ThemeProvider or recreate the theme when language changes to keep direction in sync with locale.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/i18n.ts` around lines 26 - 27, The theme direction is hardcoded as RTL in
theme.ts while the i18n configuration defaults to English in i18n.ts, creating a
mismatch where the UI always renders in RTL mode regardless of the selected
language. To fix this, synchronize the theme direction with the current language
by either extracting the language from i18n and passing it to ThemeProvider to
dynamically set the direction property based on whether the locale is RTL or
LTR, or by listening to i18n language change events and recreating the theme
with the correct direction when the language changes. Ensure that languages like
English and Russian correctly set direction to LTR while RTL languages set it
appropriately.

interpolation: {
escapeValue: false,
Expand Down
2 changes: 1 addition & 1 deletion src/layouts/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const layoutContainer: CSSProperties = {
}

export const desktopContent: CSSProperties = {
marginRight: '20%',
marginInlineStart: '20%',
width: '80%',
}

Expand Down
2 changes: 1 addition & 1 deletion src/pages/dailyReports/metricsReport/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const headerStyle = {
display: 'flex',
flexDirection: 'column',
gap: '0.3rem',
paddingRight: '5%',
paddingInlineStart: '5%',
} as CSSProperties

export const reportButtonStyle = (theme: Theme) => ({
Expand Down
2 changes: 1 addition & 1 deletion src/pages/dailyReports/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ export const titleStyleMobile = {

export const titleStyleDesktop = {
display: 'flex',
paddingRight: '2.5%',
paddingInlineStart: '2.5%',
paddingTop: '2rem',
} as CSSProperties
7 changes: 4 additions & 3 deletions src/pages/home/checkIn/CheckIn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import BusinessIcon from '@mui/icons-material/Business'
import { CheckInActions } from './CheckInActions'
import { DOT } from '@/constants/index'
import { mockAttendanceAppointmentDetails } from './checkIn.mock'
import { useDirection } from '@/hooks/useDirection'

export const CheckIn = () => {
const { t } = useTranslation()
Expand All @@ -42,7 +43,7 @@ export const CheckIn = () => {
},
)
}

const isRtl = useDirection()
const handleCheckIn = () => {
sendAttendanceUpdate(ATTENDANCE_STATUS.COMING)
}
Expand All @@ -52,8 +53,8 @@ export const CheckIn = () => {

return (
<SGLCard style={rootStyle(theme)}>
<div style={wrapperTimeIconStyle(theme)}>
<div style={TimeIconStyle(theme)}>
<div style={wrapperTimeIconStyle(theme, isRtl)}>
<div style={TimeIconStyle(theme, isRtl)}>
<AccessTimeIcon fontSize="medium" style={iconStyle(theme)} />
</div>
</div>
Expand Down
12 changes: 7 additions & 5 deletions src/pages/home/checkIn/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,25 +86,27 @@ export const warpperTopStyle = {
justifyContent: 'space-between',
} as CSSProperties

export const wrapperTimeIconStyle = (theme: Theme) => {
export const wrapperTimeIconStyle = (theme: Theme, isRtl: boolean) => {
return {
position: 'absolute',
top: -40,
left: -40,
top: 20,
...(isRtl ? { left: 25 } : { right: 25 }),
transform: isRtl ? 'translate(-50%, -50%)' : 'translate(50%, -50%)',

backgroundColor: alpha(theme.palette.background.paper, 0.1),
height: '8rem',
width: '8rem',
borderRadius: '9rem',
} as CSSProperties
}

export const TimeIconStyle = (theme: Theme) => {
export const TimeIconStyle = (theme: Theme, isRtl: boolean) => {
return {
position: 'absolute',
width: '2.5rem',
height: '2.5rem',
top: 60,
left: 60,
...(isRtl ? { left: 55 } : { right: 55 }),
borderRadius: '0.8rem',
backgroundColor: alpha(theme.palette.common.white, 0.2),
display: 'flex',
Expand Down
5 changes: 0 additions & 5 deletions src/pages/lifeStyle/LifeStyle.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
import { useTranslation } from 'react-i18next'
import { BalanceTraining } from './physioAndTrainingTab/balanceTraining/BalanceTraining'
import { DietTabExample } from './dietTab/DietTabExample'
import { RecomendationTraining } from './physioAndTrainingTab/recomendationTraining/RecomendationTraining'

export const LifeStyle = () => {
const { t } = useTranslation()
return (
<>
<div>{t('lifestyle.page')}</div>
<BalanceTraining />
<RecomendationTraining />
<DietTabExample />
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const titleRowStyle: CSSProperties = {
flexDirection: 'row',
alignItems: 'center',
gap: '0.5rem',
marginRight: '1rem',
marginInline: '1rem',
Comment thread
coderabbitai[bot] marked this conversation as resolved.
marginTop: '1rem',
}

Expand All @@ -26,7 +26,7 @@ export const typographyStyle: CSSProperties = {
export const bodyContainerStyle: CSSProperties = {
display: 'flex',
flexDirection: 'column',
marginRight: '1rem',
marginInline: '1rem',
marginTop: '0.5rem',
gap: '1rem',
marginBottom: '1rem',
Expand Down
2 changes: 1 addition & 1 deletion src/pages/schedule/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const scheduleStyles = {
} satisfies CSSProperties,
title: {
display: 'flex',
justifyContent: 'right',
justifyContent: 'start',
padding: '2rem 2rem 0 2rem',
},
}
Loading