diff --git a/adventure-rental-app/index.html b/adventure-rental-app/index.html
index 0c589ec..dd55c02 100644
--- a/adventure-rental-app/index.html
+++ b/adventure-rental-app/index.html
@@ -3,8 +3,11 @@
+
+
+
- Vite + React
+ Adventure Rental
diff --git a/adventure-rental-app/package-lock.json b/adventure-rental-app/package-lock.json
index b3ac835..41ecf52 100644
--- a/adventure-rental-app/package-lock.json
+++ b/adventure-rental-app/package-lock.json
@@ -8,6 +8,7 @@
"name": "adventure-rental-app",
"version": "0.0.0",
"dependencies": {
+ "axios": "^1.11.0",
"react": "^19.1.0",
"react-dom": "^19.1.0"
},
@@ -1607,6 +1608,12 @@
"dev": true,
"license": "Python-2.0"
},
+ "node_modules/asynckit": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
+ "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
+ "license": "MIT"
+ },
"node_modules/autoprefixer": {
"version": "10.4.21",
"resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.21.tgz",
@@ -1645,6 +1652,17 @@
"postcss": "^8.1.0"
}
},
+ "node_modules/axios": {
+ "version": "1.11.0",
+ "resolved": "https://registry.npmjs.org/axios/-/axios-1.11.0.tgz",
+ "integrity": "sha512-1Lx3WLFQWm3ooKDYZD1eXmoGO9fxYQjrycfHFC8P0sCfQVXyROp0p9PFWBehewBOdCwHc+f/b8I0fMto5eSfwA==",
+ "license": "MIT",
+ "dependencies": {
+ "follow-redirects": "^1.15.6",
+ "form-data": "^4.0.4",
+ "proxy-from-env": "^1.1.0"
+ }
+ },
"node_modules/balanced-match": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
@@ -1722,6 +1740,19 @@
"node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
}
},
+ "node_modules/call-bind-apply-helpers": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
+ "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0",
+ "function-bind": "^1.1.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
"node_modules/callsites": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
@@ -1838,6 +1869,18 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/combined-stream": {
+ "version": "1.0.8",
+ "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
+ "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
+ "license": "MIT",
+ "dependencies": {
+ "delayed-stream": "~1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
"node_modules/commander": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz",
@@ -1922,6 +1965,15 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/delayed-stream": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
+ "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.4.0"
+ }
+ },
"node_modules/didyoumean": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz",
@@ -1936,6 +1988,20 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/dunder-proto": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
+ "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
+ "license": "MIT",
+ "dependencies": {
+ "call-bind-apply-helpers": "^1.0.1",
+ "es-errors": "^1.3.0",
+ "gopd": "^1.2.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
"node_modules/eastasianwidth": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz",
@@ -1957,6 +2023,51 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/es-define-property": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
+ "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/es-errors": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
+ "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/es-object-atoms": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz",
+ "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==",
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/es-set-tostringtag": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz",
+ "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==",
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0",
+ "get-intrinsic": "^1.2.6",
+ "has-tostringtag": "^1.0.2",
+ "hasown": "^2.0.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
"node_modules/esbuild": {
"version": "0.25.8",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.8.tgz",
@@ -2340,6 +2451,26 @@
"dev": true,
"license": "ISC"
},
+ "node_modules/follow-redirects": {
+ "version": "1.15.11",
+ "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.11.tgz",
+ "integrity": "sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ==",
+ "funding": [
+ {
+ "type": "individual",
+ "url": "https://github.com/sponsors/RubenVerborgh"
+ }
+ ],
+ "license": "MIT",
+ "engines": {
+ "node": ">=4.0"
+ },
+ "peerDependenciesMeta": {
+ "debug": {
+ "optional": true
+ }
+ }
+ },
"node_modules/foreground-child": {
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz",
@@ -2357,6 +2488,22 @@
"url": "https://github.com/sponsors/isaacs"
}
},
+ "node_modules/form-data": {
+ "version": "4.0.4",
+ "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.4.tgz",
+ "integrity": "sha512-KrGhL9Q4zjj0kiUt5OO4Mr/A/jlI2jDYs5eHBpYHPcBEVSiipAvn2Ko2HnPe20rmcuuvMHNdZFp+4IlGTMF0Ow==",
+ "license": "MIT",
+ "dependencies": {
+ "asynckit": "^0.4.0",
+ "combined-stream": "^1.0.8",
+ "es-set-tostringtag": "^2.1.0",
+ "hasown": "^2.0.2",
+ "mime-types": "^2.1.12"
+ },
+ "engines": {
+ "node": ">= 6"
+ }
+ },
"node_modules/fraction.js": {
"version": "4.3.7",
"resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.3.7.tgz",
@@ -2390,7 +2537,6 @@
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
- "dev": true,
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/ljharb"
@@ -2406,6 +2552,43 @@
"node": ">=6.9.0"
}
},
+ "node_modules/get-intrinsic": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
+ "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
+ "license": "MIT",
+ "dependencies": {
+ "call-bind-apply-helpers": "^1.0.2",
+ "es-define-property": "^1.0.1",
+ "es-errors": "^1.3.0",
+ "es-object-atoms": "^1.1.1",
+ "function-bind": "^1.1.2",
+ "get-proto": "^1.0.1",
+ "gopd": "^1.2.0",
+ "has-symbols": "^1.1.0",
+ "hasown": "^2.0.2",
+ "math-intrinsics": "^1.1.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/get-proto": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz",
+ "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
+ "license": "MIT",
+ "dependencies": {
+ "dunder-proto": "^1.0.1",
+ "es-object-atoms": "^1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
"node_modules/glob": {
"version": "10.4.5",
"resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz",
@@ -2479,6 +2662,18 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/gopd": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
+ "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
@@ -2489,11 +2684,37 @@
"node": ">=8"
}
},
+ "node_modules/has-symbols": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",
+ "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/has-tostringtag": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz",
+ "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==",
+ "license": "MIT",
+ "dependencies": {
+ "has-symbols": "^1.0.3"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/hasown": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
"integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
- "dev": true,
"license": "MIT",
"dependencies": {
"function-bind": "^1.1.2"
@@ -2788,6 +3009,15 @@
"yallist": "^3.0.2"
}
},
+ "node_modules/math-intrinsics": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
+ "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
"node_modules/merge2": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
@@ -2825,6 +3055,27 @@
"url": "https://github.com/sponsors/jonschlinkert"
}
},
+ "node_modules/mime-db": {
+ "version": "1.52.0",
+ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
+ "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/mime-types": {
+ "version": "2.1.35",
+ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
+ "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
+ "license": "MIT",
+ "dependencies": {
+ "mime-db": "1.52.0"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
"node_modules/minimatch": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
@@ -3261,6 +3512,12 @@
"node": ">= 0.8.0"
}
},
+ "node_modules/proxy-from-env": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
+ "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==",
+ "license": "MIT"
+ },
"node_modules/punycode": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
diff --git a/adventure-rental-app/package.json b/adventure-rental-app/package.json
index 716f73d..dfac63e 100644
--- a/adventure-rental-app/package.json
+++ b/adventure-rental-app/package.json
@@ -10,6 +10,7 @@
"preview": "vite preview"
},
"dependencies": {
+ "axios": "^1.11.0",
"react": "^19.1.0",
"react-dom": "^19.1.0"
},
diff --git a/adventure-rental-app/src/App.jsx b/adventure-rental-app/src/App.jsx
index ae75415..e817b11 100644
--- a/adventure-rental-app/src/App.jsx
+++ b/adventure-rental-app/src/App.jsx
@@ -1,8 +1,8 @@
-import LoginPage from './LoginPage'
+import AuthPage from './AuthPage'
function App() {
return (
-
+
)
}
diff --git a/adventure-rental-app/src/AuthPage.jsx b/adventure-rental-app/src/AuthPage.jsx
new file mode 100644
index 0000000..9c1a04c
--- /dev/null
+++ b/adventure-rental-app/src/AuthPage.jsx
@@ -0,0 +1,34 @@
+import React, { useState, useCallback } from 'react';
+import LoginForm from './LoginForm';
+import SignupForm from './SignupForm';
+import OtpForm from './OtpForm';
+
+const AuthPage = () => {
+ const [view, setView] = useState('login'); // 'login', 'signup', or 'otp'
+
+ const showSignup = useCallback(() => setView('signup'), []);
+ const showLogin = useCallback(() => setView('login'), []);
+ const showOtp = useCallback(() => setView('otp'), []);
+
+ const renderForm = () => {
+ switch (view) {
+ case 'signup':
+ return ;
+ case 'otp':
+ return ;
+ case 'login':
+ default:
+ return ;
+ }
+ };
+
+ return (
+
+ );
+};
+
+export default AuthPage;
\ No newline at end of file
diff --git a/adventure-rental-app/src/LoginForm.jsx b/adventure-rental-app/src/LoginForm.jsx
new file mode 100644
index 0000000..0a0e3a6
--- /dev/null
+++ b/adventure-rental-app/src/LoginForm.jsx
@@ -0,0 +1,200 @@
+import React, { useState, useCallback } from 'react';
+import axios from 'axios';
+
+const FlashlightOnIcon = () => (
+
+);
+
+const FlashlightOffIcon = () => (
+
+);
+
+const LoginForm = ({ toggleForm, onSuccess }) => {
+ const [loginMode, setLoginMode] = useState('email'); // 'email' or 'whatsapp'
+ const [identifier, setIdentifier] = useState('');
+ const [password, setPassword] = useState('');
+ const [error, setError] = useState('');
+ const [loading, setLoading] = useState(false);
+ const [showPassword, setShowPassword] = useState(false);
+ const [emailError, setEmailError] = useState('');
+
+ const validateEmail = (email) => {
+ const regex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
+ return regex.test(email);
+ };
+
+ const handleIdentifierChange = (e) => {
+ let value = e.target.value;
+ if (loginMode === 'email') {
+ if (!validateEmail(value) && value.length > 0) {
+ setEmailError('Please enter a valid email address.');
+ } else {
+ setEmailError('');
+ }
+ } else {
+ setEmailError('');
+ if (value.startsWith('0')) {
+ value = value.substring(1);
+ }
+ value = value.replace(/[^0-9]/g, '');
+ }
+ setIdentifier(value);
+ };
+
+ const handleLogin = async (e) => {
+ e.preventDefault();
+ if (loginMode === 'email' && emailError) {
+ setError('Please fix the errors before submitting.');
+ return;
+ }
+ setLoading(true);
+ setError('');
+
+ const finalIdentifier = loginMode === 'whatsapp' ? `62${identifier}` : identifier;
+
+ try {
+ const response = await axios.post('https://api.karyamanswasta.my.id/webhook/login/adventure', {
+ identifier: finalIdentifier,
+ password,
+ });
+
+ const { token } = response.data;
+ localStorage.setItem('authToken', token);
+ console.log('Login successful, token:', token);
+ onSuccess(); // Call onSuccess to reset the form
+
+ } catch (err) {
+ setError(err.response?.data?.message || 'Login failed. Please check your credentials.');
+ } finally {
+ setLoading(false);
+ }
+ };
+
+ const handleModeChange = useCallback((mode) => {
+ setLoginMode(mode);
+ setIdentifier('');
+ setPassword('');
+ setEmailError('');
+ setShowPassword(false);
+ setError('');
+ }, []);
+
+ const togglePasswordVisibility = useCallback(() => {
+ setShowPassword(prev => !prev);
+ }, []);
+
+ return (
+ <>
+
+
+ Equipment Rental
+
+
+ Sign in to continue your adventure
+
+
+
+
+
+
+
+
+
+ >
+ );
+};
+
+export default LoginForm;
\ No newline at end of file
diff --git a/adventure-rental-app/src/LoginPage.jsx b/adventure-rental-app/src/LoginPage.jsx
deleted file mode 100644
index 7343f44..0000000
--- a/adventure-rental-app/src/LoginPage.jsx
+++ /dev/null
@@ -1,68 +0,0 @@
-import React from 'react';
-
-const LoginPage = () => {
- return (
-
- {/* Left side with description and image */}
-
-
-
Adventure Awaits!
-
- Rent the best camping gear from us and embark on your next great adventure.
-
-
-
- {/* Placeholder for an image */}
-
- Image Placeholder
-
-
-
-
- {/* Right side with login form */}
-
-
- );
-};
-
-export default LoginPage;
\ No newline at end of file
diff --git a/adventure-rental-app/src/OtpForm.jsx b/adventure-rental-app/src/OtpForm.jsx
new file mode 100644
index 0000000..1c982d3
--- /dev/null
+++ b/adventure-rental-app/src/OtpForm.jsx
@@ -0,0 +1,70 @@
+import React, { useState } from 'react';
+import axios from 'axios';
+
+const OtpForm = () => {
+ const [emailOtp, setEmailOtp] = useState('');
+ const [whatsappOtp, setWhatsappOtp] = useState('');
+ const [error, setError] = useState('');
+ const [loading, setLoading] = useState(false);
+
+ const handleVerify = async (e) => {
+ e.preventDefault();
+ setLoading(true);
+ setError('');
+
+ try {
+ // Assuming you have a webhook for OTP verification
+ await axios.post('https://api.karyamanswasta.my.id/webhook/verify-otp/adventure', {
+ emailOtp,
+ whatsappOtp,
+ });
+ // On success, you would typically redirect to the main app
+ console.log('OTP verification successful');
+ } catch (err) {
+ setError(err.response?.data?.message || 'OTP verification failed.');
+ } finally {
+ setLoading(false);
+ }
+ };
+
+ return (
+ <>
+
+
Verify Your Account
+
Enter the OTP sent to your email and WhatsApp
+
+
+ >
+ );
+};
+
+export default OtpForm;
\ No newline at end of file
diff --git a/adventure-rental-app/src/SignupForm.jsx b/adventure-rental-app/src/SignupForm.jsx
new file mode 100644
index 0000000..e4c195b
--- /dev/null
+++ b/adventure-rental-app/src/SignupForm.jsx
@@ -0,0 +1,158 @@
+import React, { useState, useEffect } from 'react';
+import axios from 'axios';
+
+const FlashlightOnIcon = () => (
+
+);
+
+const FlashlightOffIcon = () => (
+
+);
+
+const PasswordRequirement = ({ meets, label }) => (
+
+ {meets ? '✓' : '✗'} {label}
+
+);
+
+const SignupForm = ({ toggleForm, onSuccess }) => {
+ const [fullName, setFullName] = useState('');
+ const [email, setEmail] = useState('');
+ const [whatsapp, setWhatsapp] = useState('');
+ const [password, setPassword] = useState('');
+ const [confirmPassword, setConfirmPassword] = useState('');
+ const [error, setError] = useState('');
+ const [loading, setLoading] = useState(false);
+ const [showPassword, setShowPassword] = useState(false);
+ const [showConfirmPassword, setShowConfirmPassword] = useState(false);
+ const [emailError, setEmailError] = useState('');
+ const [passwordMatchError, setPasswordMatchError] = useState('');
+
+ const validateEmail = (email) => {
+ const regex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
+ return regex.test(email);
+ };
+
+ useEffect(() => {
+ if (password && confirmPassword && password !== confirmPassword) {
+ setPasswordMatchError("Passwords don't match.");
+ } else {
+ setPasswordMatchError('');
+ }
+ }, [password, confirmPassword]);
+
+ const handleEmailChange = (e) => {
+ const value = e.target.value;
+ setEmail(value);
+ if (!validateEmail(value) && value.length > 0) {
+ setEmailError('Please enter a valid email address.');
+ } else {
+ setEmailError('');
+ }
+ };
+
+ const passwordRequirements = {
+ length: password.length >= 8,
+ uppercase: /[A-Z]/.test(password),
+ lowercase: /[a-z]/.test(password),
+ number: /[0-9]/.test(password),
+ };
+ const allRequirementsMet = Object.values(passwordRequirements).every(Boolean);
+
+ const isFormValid =
+ fullName.trim() !== '' &&
+ email.trim() !== '' &&
+ !emailError &&
+ whatsapp.trim() !== '' &&
+ password.trim() !== '' &&
+ allRequirementsMet &&
+ confirmPassword.trim() !== '' &&
+ !passwordMatchError;
+
+ const handleWhatsappChange = (e) => {
+ let value = e.target.value;
+ if (value.startsWith('0')) {
+ value = value.substring(1);
+ }
+ setWhatsapp(value.replace(/[^0-9]/g, ''));
+ };
+
+ const handleSignup = async (e) => {
+ e.preventDefault();
+ if (!isFormValid) {
+ setError('Please fill in all fields correctly.');
+ return;
+ }
+ setLoading(true);
+ setError('');
+
+ try {
+ await axios.post('https://api.karyamanswasta.my.id/webhook/signup/adventure', {
+ fullName,
+ email,
+ whatsapp: `62${whatsapp}`,
+ password,
+ });
+ onSuccess();
+ } catch (err) {
+ setError(err.response?.data?.message || 'Signup failed. Please try again.');
+ } finally {
+ setLoading(false);
+ }
+ };
+
+ return (
+ <>
+
+
Create Account
+
Join the adventure
+
+
+ >
+ );
+};
+
+export default SignupForm;
\ No newline at end of file
diff --git a/adventure-rental-app/src/index.css b/adventure-rental-app/src/index.css
index b5c61c9..58559a9 100644
--- a/adventure-rental-app/src/index.css
+++ b/adventure-rental-app/src/index.css
@@ -1,3 +1,19 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
+
+body {
+ @apply bg-login-bg bg-cover bg-center font-sans;
+}
+
+/* Webkit Autofill Override */
+input:-webkit-autofill,
+input:-webkit-autofill:hover,
+input:-webkit-autofill:focus,
+input:-webkit-autofill:active {
+ -webkit-text-fill-color: #fff !important;
+ background-color: transparent !important;
+ -webkit-box-shadow: 0 0 0px 1000px rgba(0, 0, 0, 0.10) inset !important;
+ transition: background-color 5000s ease-in-out 0s;
+}
+
diff --git a/adventure-rental-app/tailwind.config.js b/adventure-rental-app/tailwind.config.js
index d37737f..e442df5 100644
--- a/adventure-rental-app/tailwind.config.js
+++ b/adventure-rental-app/tailwind.config.js
@@ -5,7 +5,21 @@ export default {
"./src/**/*.{js,ts,jsx,tsx}",
],
theme: {
- extend: {},
+ extend: {
+ colors: {
+ 'brand-green': '#4A5D23',
+ 'brand-brown': '#8B4513',
+ 'brand-light': '#F5F5DC',
+ 'brand-gray': '#A9A9A9',
+ 'brand-orange': '#D97706', // Adventure Orange
+ },
+ fontFamily: {
+ sans: ['Poppins', 'sans-serif'],
+ },
+ backgroundImage: {
+ 'login-bg': "url('https://images.unsplash.com/photo-1515444744559-7be63e1600de?q=80&w=1170&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D')",
+ }
+ },
},
plugins: [],
}