Skip to content

feat: Add initial logic#62

Merged
StoynovAngel merged 13 commits into
mainfrom
frontend/add-initial-logic
Apr 30, 2026
Merged

feat: Add initial logic#62
StoynovAngel merged 13 commits into
mainfrom
frontend/add-initial-logic

Conversation

@StoynovAngel
Copy link
Copy Markdown
Owner

@StoynovAngel StoynovAngel commented Apr 30, 2026

Summary by CodeRabbit

  • New Features

    • Implemented navigation system enabling screen-to-screen transitions
    • Added multi-language support with English and Bulgarian localization
    • Introduced header with user profile, admin access, and logout
    • Established home screen as the primary application view
  • Chores

    • Added centralized UI theme tokens
    • Updated app orientation/settings for broader device support

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 30, 2026

Warning

Rate limit exceeded

@StoynovAngel has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 27 minutes and 19 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 84a9168c-6e16-493c-b439-2702ab2dae69

📥 Commits

Reviewing files that changed from the base of the PR and between 60fd076 and 5e538e2.

📒 Files selected for processing (7)
  • frontend/.claude/settings.local.json
  • frontend/App.tsx
  • frontend/src/components/header/Header.style.tsx
  • frontend/src/components/header/Header.tsx
  • frontend/src/constants/theme.tsx
  • frontend/src/hooks/useTheme.tsx
  • frontend/src/screens/home/Home.style.tsx
📝 Walkthrough

Walkthrough

Replaces the placeholder App with a NavigationContainer-wrapped Navigation component and I18nextProvider; adds i18n config and locale files, a theme, a Header component, and a Home screen; updates Expo orientation and runtime dependencies.

Changes

Cohort / File(s) Summary
App Setup & Dependencies
frontend/App.tsx, frontend/package.json, frontend/app.json
Replaces static placeholder App with I18nextProvider + NavigationContainer mounting Navigation. Adds navigation, i18n, localization, and icon dependencies. Changes Expo orientation settings.
Navigation & Routing
frontend/src/navigation/Navigation.tsx
Adds typed RootStackParamList and a native stack navigator registering the home screen with headers hidden.
Internationalization
frontend/src/config/i18n.ts, frontend/src/assets/translate/en.json, frontend/src/assets/translate/bg.json
Adds i18n config that loads en and bg resources, selects language via expo-localization, sets fallback to en, and exports initialized i18n. Includes JSON translation files with welcome, admin, logout.
Design System
frontend/src/constants/theme.tsx
Introduces a centralized theme export with colors, spacing, typography, radii, elevations, and component-level tokens.
Home Screen
frontend/src/screens/home/Home.tsx, frontend/src/screens/home/Home.style.tsx
Adds Home screen rendering a flex container and the Header component; includes minimal container styles.
Header Component
frontend/src/components/header/Header.tsx, frontend/src/components/header/Header.style.tsx
Adds Header UI using typed navigation hook, shows hardcoded username, an Admin button that navigates to test, and a logout icon; includes styles via StyleSheet.

Sequence Diagram(s)

sequenceDiagram
    rect rgba(240,240,255,0.5)
    App->>I18nextProvider: initialize i18n (en/bg)
    end
    rect rgba(240,255,240,0.5)
    App->>NavigationContainer: mount
    NavigationContainer->>Navigation: render stack navigator
    end
    rect rgba(255,240,240,0.5)
    Navigation->>Home: render home screen
    Home->>Header: include header component
    Header->>Navigation: navigation.navigate("test") on Admin press
    Navigation->>Stack: push "test" route
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • Wipe out frontend #59: Touches the same frontend root and i18n/theme artifacts; likely to conflict with added/removed App or locale files.
  • feat: Add initial frontend #33: Adds/modifies navigation and i18n wiring similar to this PR; direct overlap in App.tsx, Navigation, and i18n configuration.

Poem

🐰
I hopped into code at break of day,
Wove routes and words so users may say,
“Hello” in English, “Здравей” too,
A header, theme, and paths anew —
Carrots and commits, all stitched in play. 🥕

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Add initial logic' is too vague and generic, lacking specific details about what initial logic is being added or which component/feature is affected. Provide a more specific title that describes the main change, such as 'feat: Set up navigation, i18n, and header component' or 'feat: Initialize app navigation and internationalization'.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch frontend/add-initial-logic

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 27 minutes and 19 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (2)
frontend/src/components/header/Header.style.tsx (1)

9-15: ⚡ Quick win

Use theme tokens for spacing/sizing to avoid style drift.

Several hard-coded values bypass the centralized theme (for example, header height differs from theme.components.header.height). Prefer theme tokens for consistency and easier global updates.

Proposed refactor
     header: {
         flexDirection: 'row',
         justifyContent: 'space-between',
         alignItems: 'center',
-        paddingHorizontal: 16,
-        paddingVertical: 12,
+        paddingHorizontal: theme.components.header.paddingHorizontal,
+        paddingVertical: theme.components.header.paddingVertical,
         backgroundColor: theme.colors.surface,
         borderBottomWidth: 1,
         borderBottomColor: theme.colors.border,
         width: "100%",
-        height: 60,
+        height: theme.components.header.height,
     },
@@
-        marginRight: 10,
+        marginRight: theme.spacing.sm,
@@
-        fontSize: 16,
+        fontSize: theme.fontSizes.body,
@@
-        marginLeft: 8,
+        marginLeft: theme.spacing.sm,
@@
-        paddingHorizontal: 12,
-        paddingVertical: 6,
-        borderRadius: 8,
+        paddingHorizontal: theme.spacing.md,
+        paddingVertical: theme.spacing.xs + 2,
+        borderRadius: theme.radii.md,
@@
-        marginHorizontal: 8,
+        marginHorizontal: theme.spacing.sm,
@@
-        fontSize: 14,
+        fontSize: theme.fontSizes.body,

Also applies to: 26-27, 29-29, 36-36, 41-43, 46-46, 51-51

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/src/components/header/Header.style.tsx` around lines 9 - 15, The
header styles use hard-coded spacing and sizing (e.g., paddingHorizontal: 16,
paddingVertical: 12, height: 60, borderBottomWidth/color) which bypass theme
tokens; update the style object in Header.style.tsx (the header container style
used by the Header component) to consume the centralized theme tokens such as
theme.components.header.height, theme.components.header.padding or
theme.spacing/<appropriate token>, theme.colors.border and theme.border.width
(or theme.sizes) instead of raw numbers, and propagate the same token
replacements for the other occurrences called out (lines around 26-27, 29, 36,
41-43, 46, 51) so all paddings, margins, heights, border widths and colors use
theme values consistently.
frontend/src/components/header/Header.tsx (1)

20-20: ⚡ Quick win

Use translation key for user-facing label.

Line 20 hardcodes "Admin" even though an admin translation key exists; this will not localize with language changes.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/src/components/header/Header.tsx` at line 20, The Text node in the
Header component currently renders the hardcoded string "Admin" (Text with
styles.adminButtonText); replace it with the localized string using the existing
translation key "admin" (e.g., call the project’s i18n translator like
t('admin') or useTranslation().t inside the Header component), and ensure the
translation hook/import is added to Header.tsx if missing so the label is
localized across languages.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@frontend/src/assets/translate/bg.json`:
- Line 4: Replace the English "logout" value in the Bulgarian translation
resource by localizing the "logout" key in
frontend/src/assets/translate/bg.json; update the "logout" entry to the correct
Bulgarian string (e.g., "Изход" or the preferred Bulgarian term used across the
app) so the "logout" key returns a Bulgarian value instead of "Logout".

In `@frontend/src/components/header/Header.tsx`:
- Around line 23-25: The logout Pressable (component Pressable with
styles.logoutButton rendering MaterialIcons) lacks an onPress handler, so wire
it to the app's logout routine by adding an onPress prop that invokes the
existing logout function (e.g., onPress={() => handleLogout()} or
onPress={logout} or props.onLogout) and ensure the handler performs sign-out and
navigation cleanup; also add an accessibilityLabel like "logout-button" if
missing.

In `@frontend/src/navigation/Navigation.tsx`:
- Around line 6-11: RootStackParamList declares routes (login, profile, test)
that are not registered with the navigator, which can compile but break at
runtime; either remove the unused keys from RootStackParamList so it only lists
the actually registered route(s) (e.g., keep only "home"), or add corresponding
Stack.Screen registrations for "login", "profile" (with the { userId: number }
param shape) and "test" in the Navigation component where you call
createStackNavigator/Stack.Screen; update the RootStackParamList and screen
names together so the type keys (RootStackParamList) exactly match the
Stack.Screen name props and the profile param signature matches the component
props.

---

Nitpick comments:
In `@frontend/src/components/header/Header.style.tsx`:
- Around line 9-15: The header styles use hard-coded spacing and sizing (e.g.,
paddingHorizontal: 16, paddingVertical: 12, height: 60, borderBottomWidth/color)
which bypass theme tokens; update the style object in Header.style.tsx (the
header container style used by the Header component) to consume the centralized
theme tokens such as theme.components.header.height,
theme.components.header.padding or theme.spacing/<appropriate token>,
theme.colors.border and theme.border.width (or theme.sizes) instead of raw
numbers, and propagate the same token replacements for the other occurrences
called out (lines around 26-27, 29, 36, 41-43, 46, 51) so all paddings, margins,
heights, border widths and colors use theme values consistently.

In `@frontend/src/components/header/Header.tsx`:
- Line 20: The Text node in the Header component currently renders the hardcoded
string "Admin" (Text with styles.adminButtonText); replace it with the localized
string using the existing translation key "admin" (e.g., call the project’s i18n
translator like t('admin') or useTranslation().t inside the Header component),
and ensure the translation hook/import is added to Header.tsx if missing so the
label is localized across languages.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: bd117afd-22cc-42b3-8e7f-895b09aae0a5

📥 Commits

Reviewing files that changed from the base of the PR and between b350e64 and dc5df5b.

⛔ Files ignored due to path filters (2)
  • frontend/package-lock.json is excluded by !**/package-lock.json
  • frontend/src/assets/images/logout-svgrepo-com.svg is excluded by !**/*.svg
📒 Files selected for processing (11)
  • frontend/App.tsx
  • frontend/package.json
  • frontend/src/assets/translate/bg.json
  • frontend/src/assets/translate/en.json
  • frontend/src/components/header/Header.style.tsx
  • frontend/src/components/header/Header.tsx
  • frontend/src/config/i18n.ts
  • frontend/src/constants/theme.tsx
  • frontend/src/navigation/Navigation.tsx
  • frontend/src/screens/home/Home.style.tsx
  • frontend/src/screens/home/Home.tsx

Comment thread frontend/src/assets/translate/bg.json
Comment thread frontend/src/components/header/Header.tsx
Comment thread frontend/src/navigation/Navigation.tsx
@sonarqubecloud
Copy link
Copy Markdown

@StoynovAngel StoynovAngel merged commit 13fc02a into main Apr 30, 2026
7 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request May 4, 2026
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.

1 participant