From e3b75fdfd1c483c4db5d97fb1a1a93006de4319c Mon Sep 17 00:00:00 2001 From: Fajar Nazmi Fadillah Date: Fri, 28 Feb 2025 14:14:32 +0700 Subject: [PATCH 1/6] feature; render smaller heading in Login and Register page --- src/pages/LoginPage.jsx | 2 +- src/pages/RegisterPage.jsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/LoginPage.jsx b/src/pages/LoginPage.jsx index 6bc4d7d..124e136 100644 --- a/src/pages/LoginPage.jsx +++ b/src/pages/LoginPage.jsx @@ -16,7 +16,7 @@ const LoginPage = () => { return (
-
+

Rumpi.

diff --git a/src/pages/RegisterPage.jsx b/src/pages/RegisterPage.jsx index 472c47d..95870e6 100644 --- a/src/pages/RegisterPage.jsx +++ b/src/pages/RegisterPage.jsx @@ -19,7 +19,7 @@ const RegisterPage = () => { return (
-
+

Rumpi.

From 6e42d640e5af7a95614899241462644e2d1b0456 Mon Sep 17 00:00:00 2001 From: Fajar Nazmi Fadillah Date: Fri, 28 Feb 2025 14:24:29 +0700 Subject: [PATCH 2/6] chore; attempt to preload the Open Sans font to comply with LCP FCP --- index.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index a9d95e4..a2cbfb4 100644 --- a/index.html +++ b/index.html @@ -7,7 +7,8 @@ - + + From b214d84bd7e36246a351fb0fcacfdf74c989a902 Mon Sep 17 00:00:00 2001 From: Fajar Nazmi Fadillah Date: Fri, 28 Feb 2025 14:36:34 +0700 Subject: [PATCH 3/6] chore; add testcase for theme redux --- src/states/theme/action.test.js | 41 +++++++++++++++++++++++++++++ src/states/theme/reducer.test.js | 45 ++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 src/states/theme/action.test.js create mode 100644 src/states/theme/reducer.test.js diff --git a/src/states/theme/action.test.js b/src/states/theme/action.test.js new file mode 100644 index 0000000..c505f86 --- /dev/null +++ b/src/states/theme/action.test.js @@ -0,0 +1,41 @@ +/** + * - Test scenario themeAction + * - should create an action to toggle theme + * - should create an action to set light theme + * - should create an action to set dark theme + */ + +import { describe, it, expect } from 'vitest'; +import { ActionType, toggleTheme, setLightTheme, setDarkTheme } from './action'; + +describe('theme actions', () => { + it('should create an action to toggle theme', () => { + // Arrange + const expectedAction = { + type: ActionType.TOGGLE_THEME, + }; + + // Assert + expect(toggleTheme()).toEqual(expectedAction); + }); + + it('should create an action to set light theme', () => { + // Arrange + const expectedAction = { + type: ActionType.SET_LIGHT_THEME, + }; + + // Assert + expect(setLightTheme()).toEqual(expectedAction); + }); + + it('should create an action to set dark theme', () => { + // Arrange + const expectedAction = { + type: ActionType.SET_DARK_THEME, + }; + + // Assert + expect(setDarkTheme()).toEqual(expectedAction); + }); +}); \ No newline at end of file diff --git a/src/states/theme/reducer.test.js b/src/states/theme/reducer.test.js new file mode 100644 index 0000000..806e5ec --- /dev/null +++ b/src/states/theme/reducer.test.js @@ -0,0 +1,45 @@ +/** + * - Test scenario themeReducer + * - should return the initial state + * - should handle TOGGLE_THEME + * - should handle SET_LIGHT_THEME + * - should handle SET_DARK_THEME + */ + +import { describe, it, expect } from 'vitest'; +import themeReducer from './reducer'; + +import { ActionType } from './action'; + +describe('themeReducer', () => { + it('should return the initial state', () => { + const initialState = { mode: 'light' }; + const action = {}; + const state = themeReducer(initialState, action); + expect(state).toEqual(initialState); + }); + + it('should handle TOGGLE_THEME', () => { + const initialState = { mode: 'light' }; + const action = { type: ActionType.TOGGLE_THEME }; + const state = themeReducer(initialState, action); + expect(state).toEqual({ mode: 'dark' }); + + const newState = themeReducer(state, action); + expect(newState).toEqual({ mode: 'light' }); + }); + + it('should handle SET_LIGHT_THEME', () => { + const initialState = { mode: 'dark' }; + const action = { type: ActionType.SET_LIGHT_THEME }; + const state = themeReducer(initialState, action); + expect(state).toEqual({ mode: 'light' }); + }); + + it('should handle SET_DARK_THEME', () => { + const initialState = { mode: 'light' }; + const action = { type: ActionType.SET_DARK_THEME }; + const state = themeReducer(initialState, action); + expect(state).toEqual({ mode: 'dark' }); + }); +}); \ No newline at end of file From 576733f9763fec80155e75c9a6c75fbcfcb54bc9 Mon Sep 17 00:00:00 2001 From: Fajar Nazmi Fadillah Date: Fri, 28 Feb 2025 14:44:44 +0700 Subject: [PATCH 4/6] chore; modify register/login nav page to use more contrast text --- src/pages/LoginPage.jsx | 2 +- src/pages/RegisterPage.jsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/LoginPage.jsx b/src/pages/LoginPage.jsx index 124e136..c1a93e1 100644 --- a/src/pages/LoginPage.jsx +++ b/src/pages/LoginPage.jsx @@ -30,7 +30,7 @@ const LoginPage = () => {

{t('no_account_yet')} {' '} - {t('register')} + {t('register')}

diff --git a/src/pages/RegisterPage.jsx b/src/pages/RegisterPage.jsx index 95870e6..e685568 100644 --- a/src/pages/RegisterPage.jsx +++ b/src/pages/RegisterPage.jsx @@ -29,7 +29,7 @@ const RegisterPage = () => {

{t('already_have_account')} {' '} - {t('login')} + {t('login')}

From 7919a7c738c501d30af303fcb15f6a43e2410aa1 Mon Sep 17 00:00:00 2001 From: Fajar Nazmi Fadillah Date: Fri, 28 Feb 2025 14:46:55 +0700 Subject: [PATCH 5/6] feature; adding meta description for SEO --- index.html | 1 + 1 file changed, 1 insertion(+) diff --git a/index.html b/index.html index a2cbfb4..dace95a 100644 --- a/index.html +++ b/index.html @@ -4,6 +4,7 @@ Rumpi + From 5bb315092fd43af29f86d91055b312cfe2305555 Mon Sep 17 00:00:00 2001 From: Fajar Nazmi Fadillah Date: Fri, 28 Feb 2025 14:48:12 +0700 Subject: [PATCH 6/6] chore; modify i18n's debug value to false --- i18n.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i18n.js b/i18n.js index 5d8a50c..0867dfa 100644 --- a/i18n.js +++ b/i18n.js @@ -12,7 +12,7 @@ i18n .use(initReactI18next) .init({ fallbackLng: 'en', - debug: true, + debug: false, interpolation: { escapeValue: false, },