open README.md for all details
41
.gitignore
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
/.pnp
|
||||
.pnp.*
|
||||
.yarn/*
|
||||
!.yarn/patches
|
||||
!.yarn/plugins
|
||||
!.yarn/releases
|
||||
!.yarn/versions
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
# next.js
|
||||
/.next/
|
||||
/out/
|
||||
|
||||
# production
|
||||
/build
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
*.pem
|
||||
|
||||
# debug
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
.pnpm-debug.log*
|
||||
|
||||
# env files (can opt-in for committing if needed)
|
||||
.env*
|
||||
|
||||
# vercel
|
||||
.vercel
|
||||
|
||||
# typescript
|
||||
*.tsbuildinfo
|
||||
next-env.d.ts
|
||||
10
README.md
Normal file
@ -0,0 +1,10 @@
|
||||
Commit - 1
|
||||
|
||||
Tech stack - Next.js , tailwind css
|
||||
|
||||
Status - Currently, this project has a fully developed single page(brokers) where user can add, view, edit and delete broker details.
|
||||
|
||||
Issues - Maintain same color palatte and also add icons instead of the placeholder text
|
||||
|
||||
Next Goal - Break down one huge file into different components to improve readability and reusability.
|
||||
----> The directories for this has been already created
|
||||
25
eslint.config.mjs
Normal file
@ -0,0 +1,25 @@
|
||||
import { dirname } from "path";
|
||||
import { fileURLToPath } from "url";
|
||||
import { FlatCompat } from "@eslint/eslintrc";
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = dirname(__filename);
|
||||
|
||||
const compat = new FlatCompat({
|
||||
baseDirectory: __dirname,
|
||||
});
|
||||
|
||||
const eslintConfig = [
|
||||
...compat.extends("next/core-web-vitals"),
|
||||
{
|
||||
ignores: [
|
||||
"node_modules/**",
|
||||
".next/**",
|
||||
"out/**",
|
||||
"build/**",
|
||||
"next-env.d.ts",
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
export default eslintConfig;
|
||||
7
jsconfig.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"paths": {
|
||||
"@/*": ["./src/*"]
|
||||
}
|
||||
}
|
||||
}
|
||||
4
next.config.mjs
Normal file
@ -0,0 +1,4 @@
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {};
|
||||
|
||||
export default nextConfig;
|
||||
6058
package-lock.json
generated
Normal file
26
package.json
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"name": "hook-nest",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev --turbopack",
|
||||
"build": "next build --turbopack",
|
||||
"start": "next start",
|
||||
"lint": "eslint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tailwindcss/postcss": "^4.1.14",
|
||||
"framer-motion": "^12.23.22",
|
||||
"lucide-react": "^0.544.0",
|
||||
"next": "15.5.4",
|
||||
"postcss": "^8.5.6",
|
||||
"react": "19.1.0",
|
||||
"react-dom": "19.1.0",
|
||||
"tailwindcss": "^4.1.14"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/eslintrc": "^3",
|
||||
"eslint": "^9",
|
||||
"eslint-config-next": "15.5.4"
|
||||
}
|
||||
}
|
||||
7
postcss.config.mjs
Normal file
@ -0,0 +1,7 @@
|
||||
const config = {
|
||||
plugins: {
|
||||
"@tailwindcss/postcss": {},
|
||||
},
|
||||
};
|
||||
|
||||
export default config;
|
||||
1
public/file.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg fill="none" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M14.5 13.5V5.41a1 1 0 0 0-.3-.7L9.8.29A1 1 0 0 0 9.08 0H1.5v13.5A2.5 2.5 0 0 0 4 16h8a2.5 2.5 0 0 0 2.5-2.5m-1.5 0v-7H8v-5H3v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1M9.5 5V2.12L12.38 5zM5.13 5h-.62v1.25h2.12V5zm-.62 3h7.12v1.25H4.5zm.62 3h-.62v1.25h7.12V11z" clip-rule="evenodd" fill="#666" fill-rule="evenodd"/></svg>
|
||||
|
After Width: | Height: | Size: 391 B |
1
public/globe.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><g clip-path="url(#a)"><path fill-rule="evenodd" clip-rule="evenodd" d="M10.27 14.1a6.5 6.5 0 0 0 3.67-3.45q-1.24.21-2.7.34-.31 1.83-.97 3.1M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16m.48-1.52a7 7 0 0 1-.96 0H7.5a4 4 0 0 1-.84-1.32q-.38-.89-.63-2.08a40 40 0 0 0 3.92 0q-.25 1.2-.63 2.08a4 4 0 0 1-.84 1.31zm2.94-4.76q1.66-.15 2.95-.43a7 7 0 0 0 0-2.58q-1.3-.27-2.95-.43a18 18 0 0 1 0 3.44m-1.27-3.54a17 17 0 0 1 0 3.64 39 39 0 0 1-4.3 0 17 17 0 0 1 0-3.64 39 39 0 0 1 4.3 0m1.1-1.17q1.45.13 2.69.34a6.5 6.5 0 0 0-3.67-3.44q.65 1.26.98 3.1M8.48 1.5l.01.02q.41.37.84 1.31.38.89.63 2.08a40 40 0 0 0-3.92 0q.25-1.2.63-2.08a4 4 0 0 1 .85-1.32 7 7 0 0 1 .96 0m-2.75.4a6.5 6.5 0 0 0-3.67 3.44 29 29 0 0 1 2.7-.34q.31-1.83.97-3.1M4.58 6.28q-1.66.16-2.95.43a7 7 0 0 0 0 2.58q1.3.27 2.95.43a18 18 0 0 1 0-3.44m.17 4.71q-1.45-.12-2.69-.34a6.5 6.5 0 0 0 3.67 3.44q-.65-1.27-.98-3.1" fill="#666"/></g><defs><clipPath id="a"><path fill="#fff" d="M0 0h16v16H0z"/></clipPath></defs></svg>
|
||||
|
After Width: | Height: | Size: 1.0 KiB |
1
public/next.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 394 80"><path fill="#000" d="M262 0h68.5v12.7h-27.2v66.6h-13.6V12.7H262V0ZM149 0v12.7H94v20.4h44.3v12.6H94v21h55v12.6H80.5V0h68.7zm34.3 0h-17.8l63.8 79.4h17.9l-32-39.7 32-39.6h-17.9l-23 28.6-23-28.6zm18.3 56.7-9-11-27.1 33.7h17.8l18.3-22.7z"/><path fill="#000" d="M81 79.3 17 0H0v79.3h13.6V17l50.2 62.3H81Zm252.6-.4c-1 0-1.8-.4-2.5-1s-1.1-1.6-1.1-2.6.3-1.8 1-2.5 1.6-1 2.6-1 1.8.3 2.5 1a3.4 3.4 0 0 1 .6 4.3 3.7 3.7 0 0 1-3 1.8zm23.2-33.5h6v23.3c0 2.1-.4 4-1.3 5.5a9.1 9.1 0 0 1-3.8 3.5c-1.6.8-3.5 1.3-5.7 1.3-2 0-3.7-.4-5.3-1s-2.8-1.8-3.7-3.2c-.9-1.3-1.4-3-1.4-5h6c.1.8.3 1.6.7 2.2s1 1.2 1.6 1.5c.7.4 1.5.5 2.4.5 1 0 1.8-.2 2.4-.6a4 4 0 0 0 1.6-1.8c.3-.8.5-1.8.5-3V45.5zm30.9 9.1a4.4 4.4 0 0 0-2-3.3 7.5 7.5 0 0 0-4.3-1.1c-1.3 0-2.4.2-3.3.5-.9.4-1.6 1-2 1.6a3.5 3.5 0 0 0-.3 4c.3.5.7.9 1.3 1.2l1.8 1 2 .5 3.2.8c1.3.3 2.5.7 3.7 1.2a13 13 0 0 1 3.2 1.8 8.1 8.1 0 0 1 3 6.5c0 2-.5 3.7-1.5 5.1a10 10 0 0 1-4.4 3.5c-1.8.8-4.1 1.2-6.8 1.2-2.6 0-4.9-.4-6.8-1.2-2-.8-3.4-2-4.5-3.5a10 10 0 0 1-1.7-5.6h6a5 5 0 0 0 3.5 4.6c1 .4 2.2.6 3.4.6 1.3 0 2.5-.2 3.5-.6 1-.4 1.8-1 2.4-1.7a4 4 0 0 0 .8-2.4c0-.9-.2-1.6-.7-2.2a11 11 0 0 0-2.1-1.4l-3.2-1-3.8-1c-2.8-.7-5-1.7-6.6-3.2a7.2 7.2 0 0 1-2.4-5.7 8 8 0 0 1 1.7-5 10 10 0 0 1 4.3-3.5c2-.8 4-1.2 6.4-1.2 2.3 0 4.4.4 6.2 1.2 1.8.8 3.2 2 4.3 3.4 1 1.4 1.5 3 1.5 5h-5.8z"/></svg>
|
||||
|
After Width: | Height: | Size: 1.3 KiB |
1
public/vercel.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1155 1000"><path d="m577.3 0 577.4 1000H0z" fill="#fff"/></svg>
|
||||
|
After Width: | Height: | Size: 128 B |
1
public/window.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" d="M1.5 2.5h13v10a1 1 0 0 1-1 1h-11a1 1 0 0 1-1-1zM0 1h16v11.5a2.5 2.5 0 0 1-2.5 2.5h-11A2.5 2.5 0 0 1 0 12.5zm3.75 4.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5M7 4.75a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0m1.75.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5" fill="#666"/></svg>
|
||||
|
After Width: | Height: | Size: 385 B |
6
src/app/AIStrategyBuilder/page.js
Normal file
@ -0,0 +1,6 @@
|
||||
|
||||
export default function AIStrategyBuilder() {
|
||||
return (
|
||||
<div>AI Strategy Builder</div>
|
||||
)
|
||||
}
|
||||
364
src/app/Brokers/page.js
Normal file
@ -0,0 +1,364 @@
|
||||
'use client';
|
||||
|
||||
import React, { useState } from 'react';
|
||||
import { X, Plus, Edit2, Copy, Trash2, MoreVertical, Search, Filter } from 'lucide-react';
|
||||
|
||||
export default function BrokerManagement() {
|
||||
const [brokers, setBrokers] = useState([
|
||||
{ id: 'BR301', name: 'Techbonds Markets', broker: 'Masak', dateAdded: 'Feb 16, 2025', status: 'active', balance: '$978.50', apiKey: 'api_key_123456789abcdef', secretKey: 'sk_412345LH...', dateCreated: '04/12/2025' },
|
||||
{ id: 'BR295', name: 'Techbonds Markets', broker: 'AngelOne', dateAdded: 'Mar 02, 2025', status: 'expired', balance: '$978.50', apiKey: 'api_key_987654321fedcba', secretKey: 'sk_987654LH...', dateCreated: '03/02/2025' },
|
||||
{ id: 'BR298', name: 'MarketEases', broker: 'Masak', dateAdded: 'Feb 14, 2025', status: 'active', balance: '$102.25', apiKey: 'api_key_111222333444555', secretKey: 'sk_111222LH...', dateCreated: '02/14/2025' },
|
||||
{ id: 'BR293', name: 'Techbonds Markets', broker: 'Zerodha', dateAdded: 'Mar 03, 2025', status: 'inactive', balance: '$978.50', apiKey: 'api_key_555444333222111', secretKey: 'sk_555444LH...', dateCreated: '03/03/2025' },
|
||||
{ id: 'BR297', name: 'Techbonds Markets', broker: 'Dhan', dateAdded: 'Feb 14, 2025', status: 'active', balance: '$102.25', apiKey: 'api_key_666777888999000', secretKey: 'sk_666777LH...', dateCreated: '02/14/2025' },
|
||||
{ id: 'BR292', name: 'Techbonds Markets', broker: 'AngelOne', dateAdded: 'Mar 02, 2025', status: 'inactive', balance: '$978.50', apiKey: 'api_key_000999888777666', secretKey: 'sk_000999LH...', dateCreated: '03/02/2025' },
|
||||
]);
|
||||
|
||||
const [isSlideOpen, setIsSlideOpen] = useState(false);
|
||||
const [slideMode, setSlideMode] = useState('add');
|
||||
const [selectedBroker, setSelectedBroker] = useState(null);
|
||||
const [searchTerm, setSearchTerm] = useState('');
|
||||
const [filterStatus, setFilterStatus] = useState('all');
|
||||
|
||||
const [formData, setFormData] = useState({
|
||||
name: '',
|
||||
broker: '',
|
||||
apiKey: '',
|
||||
secretKey: '',
|
||||
});
|
||||
|
||||
const handleAdd = () => {
|
||||
setSlideMode('add');
|
||||
setFormData({ name: '', broker: '', apiKey: '', secretKey: '' });
|
||||
setIsSlideOpen(true);
|
||||
};
|
||||
|
||||
const handleEdit = (broker) => {
|
||||
setSlideMode('edit');
|
||||
setSelectedBroker(broker);
|
||||
setFormData({
|
||||
name: broker.name,
|
||||
broker: broker.broker,
|
||||
apiKey: broker.apiKey,
|
||||
secretKey: broker.secretKey,
|
||||
});
|
||||
setIsSlideOpen(true);
|
||||
};
|
||||
|
||||
const handleSubmit = () => {
|
||||
if (slideMode === 'add') {
|
||||
const newBroker = {
|
||||
id: `BR${Math.floor(Math.random() * 1000)}`,
|
||||
name: formData.name,
|
||||
broker: formData.broker,
|
||||
dateAdded: new Date().toLocaleDateString('en-US', { month: 'short', day: '2-digit', year: 'numeric' }),
|
||||
status: 'active',
|
||||
balance: '$0.00',
|
||||
apiKey: formData.apiKey,
|
||||
secretKey: formData.secretKey,
|
||||
dateCreated: new Date().toLocaleDateString('en-US'),
|
||||
};
|
||||
setBrokers([...brokers, newBroker]);
|
||||
} else if (selectedBroker) {
|
||||
setBrokers(brokers.map(b =>
|
||||
b.id === selectedBroker.id
|
||||
? { ...b, name: formData.name, broker: formData.broker, apiKey: formData.apiKey, secretKey: formData.secretKey }
|
||||
: b
|
||||
));
|
||||
}
|
||||
setIsSlideOpen(false);
|
||||
};
|
||||
|
||||
const handleDelete = (id) => {
|
||||
setBrokers(brokers.filter(b => b.id !== id));
|
||||
};
|
||||
|
||||
const toggleStatus = (id) => {
|
||||
setBrokers(brokers.map(b =>
|
||||
b.id === id
|
||||
? { ...b, status: b.status === 'active' ? 'inactive' : 'active' }
|
||||
: b
|
||||
));
|
||||
};
|
||||
|
||||
const filteredBrokers = brokers.filter(broker => {
|
||||
const matchesSearch = broker.name.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
||||
broker.broker.toLowerCase().includes(searchTerm.toLowerCase());
|
||||
const matchesFilter = filterStatus === 'all' || broker.status === filterStatus;
|
||||
return matchesSearch && matchesFilter;
|
||||
});
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-gray-50 p-6">
|
||||
{/* Header Section */}
|
||||
<div className="mb-6">
|
||||
<div className="flex items-center justify-between mb-4">
|
||||
<h1 className="text-2xl font-bold text-gray-900">Brokers / API Management</h1>
|
||||
<button
|
||||
onClick={handleAdd}
|
||||
className="flex items-center gap-2 bg-teal-500 hover:bg-teal-600 text-white px-4 py-2 rounded-lg transition-colors"
|
||||
>
|
||||
<Plus size={20} />
|
||||
Add Broker
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* Filters and Search */}
|
||||
<div className="flex items-center gap-4">
|
||||
<div className="flex-1 relative">
|
||||
<Search className="absolute left-3 top-1/2 -translate-y-1/2 text-gray-400" size={20} />
|
||||
<input
|
||||
type="text"
|
||||
placeholder="Search..."
|
||||
value={searchTerm}
|
||||
onChange={(e) => setSearchTerm(e.target.value)}
|
||||
className="w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-teal-500"
|
||||
/>
|
||||
</div>
|
||||
<button className="flex items-center gap-2 px-4 py-2 border border-gray-300 rounded-lg hover:bg-gray-50">
|
||||
<Filter size={20} />
|
||||
Filters
|
||||
</button>
|
||||
<div className="flex gap-2">
|
||||
<button
|
||||
onClick={() => setFilterStatus('all')}
|
||||
className={`px-4 py-2 rounded-lg ${filterStatus === 'all' ? 'bg-gray-200' : 'bg-white border border-gray-300'}`}
|
||||
>
|
||||
Active
|
||||
</button>
|
||||
<button
|
||||
onClick={() => setFilterStatus('inactive')}
|
||||
className={`px-4 py-2 rounded-lg ${filterStatus === 'inactive' ? 'bg-gray-200' : 'bg-white border border-gray-300'}`}
|
||||
>
|
||||
Inactive
|
||||
</button>
|
||||
<button
|
||||
onClick={() => setFilterStatus('expired')}
|
||||
className={`px-4 py-2 rounded-lg ${filterStatus === 'expired' ? 'bg-gray-200' : 'bg-white border border-gray-300'}`}
|
||||
>
|
||||
Expired
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Table */}
|
||||
<div className="bg-white rounded-lg shadow overflow-hidden">
|
||||
<table className="w-full">
|
||||
<thead className="bg-gray-50 border-b border-gray-200">
|
||||
<tr>
|
||||
<th className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Name</th>
|
||||
<th className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">API ID</th>
|
||||
<th className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Broker</th>
|
||||
<th className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Date Added</th>
|
||||
<th className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Status</th>
|
||||
<th className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Balance</th>
|
||||
<th className="px-6 py-3 text-center text-xs font-medium text-gray-500 uppercase tracking-wider"></th>
|
||||
<th className="px-6 py-3 text-center text-xs font-medium text-gray-500 uppercase tracking-wider"></th>
|
||||
<th className="px-6 py-3 text-center text-xs font-medium text-gray-500 uppercase tracking-wider"></th>
|
||||
<th className="px-6 py-3 text-center text-xs font-medium text-gray-500 uppercase tracking-wider">On/Off</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody className="bg-white divide-y divide-gray-200">
|
||||
{filteredBrokers.map((broker) => (
|
||||
<tr key={broker.id} className="hover:bg-gray-50">
|
||||
<td className="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">{broker.name}</td>
|
||||
<td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500">{broker.id}</td>
|
||||
<td className="px-6 py-4 whitespace-nowrap">
|
||||
<div className="flex items-center gap-2">
|
||||
<div className="w-6 h-6 bg-blue-500 rounded-full flex items-center justify-center text-white text-xs">
|
||||
{broker.broker.charAt(0)}
|
||||
</div>
|
||||
<span className="text-sm text-gray-900">{broker.broker}</span>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500">{broker.dateAdded}</td>
|
||||
<td className="px-6 py-4 whitespace-nowrap">
|
||||
<span className={`inline-flex items-center w-2.5 h-2.5 rounded-full ${
|
||||
broker.status === 'active' ? 'bg-green-500' :
|
||||
broker.status === 'expired' ? 'bg-red-500' :
|
||||
'bg-yellow-500'
|
||||
}`}></span>
|
||||
</td>
|
||||
<td className="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{broker.balance}</td>
|
||||
<td className="px-4 py-4 whitespace-nowrap text-center">
|
||||
<button className="p-1.5 hover:bg-gray-100 rounded text-gray-600" title="Info">
|
||||
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
|
||||
<circle cx="12" cy="12" r="10"/>
|
||||
<line x1="12" y1="16" x2="12" y2="12"/>
|
||||
<line x1="12" y1="8" x2="12.01" y2="8"/>
|
||||
</svg>
|
||||
</button>
|
||||
</td>
|
||||
<td className="px-4 py-4 whitespace-nowrap text-center">
|
||||
<button
|
||||
onClick={() => handleEdit(broker)}
|
||||
className="p-1.5 hover:bg-gray-100 rounded text-gray-600"
|
||||
title="Edit"
|
||||
>
|
||||
<Edit2 size={18} />
|
||||
</button>
|
||||
</td>
|
||||
<td className="px-4 py-4 whitespace-nowrap text-center">
|
||||
<button
|
||||
onClick={() => handleDelete(broker.id)}
|
||||
className="p-1.5 hover:bg-gray-100 rounded text-gray-600"
|
||||
title="Delete"
|
||||
>
|
||||
<Trash2 size={18} />
|
||||
</button>
|
||||
</td>
|
||||
<td className="px-6 py-4 whitespace-nowrap text-center">
|
||||
<button
|
||||
onClick={() => toggleStatus(broker.id)}
|
||||
className={`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${
|
||||
broker.status === 'active' ? 'bg-teal-500' : 'bg-gray-300'
|
||||
}`}
|
||||
>
|
||||
<span
|
||||
className={`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${
|
||||
broker.status === 'active' ? 'translate-x-6' : 'translate-x-1'
|
||||
}`}
|
||||
/>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
{/* Slide-in Panel */}
|
||||
{isSlideOpen && (
|
||||
<>
|
||||
{/* Overlay */}
|
||||
<div
|
||||
className="fixed inset-0 bg-gray-300 bg-opacity-80 z-40"
|
||||
onClick={() => setIsSlideOpen(false)}
|
||||
></div>
|
||||
|
||||
{/* Slide Panel */}
|
||||
<div className="fixed right-0 top-0 h-full w-96 bg-white shadow-2xl z-50 transform transition-transform duration-300 ease-in-out">
|
||||
<div className="flex flex-col h-full">
|
||||
{/* Header */}
|
||||
<div className="flex items-center justify-between p-6 border-b">
|
||||
<h2 className="text-xl font-semibold text-gray-900">
|
||||
{slideMode === 'add' ? 'Add Broker' : 'Edit Broker'}
|
||||
</h2>
|
||||
<button
|
||||
onClick={() => setIsSlideOpen(false)}
|
||||
className="p-2 hover:bg-gray-100 rounded-lg"
|
||||
>
|
||||
<X size={20} />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* Content */}
|
||||
<div className="flex-1 overflow-y-auto p-6">
|
||||
<p className="text-sm text-gray-500 mb-6">
|
||||
Choose your preferred exchange to add a broker.
|
||||
</p>
|
||||
|
||||
{/* Broker Details */}
|
||||
<div className="space-y-4 mb-6">
|
||||
<h3 className="font-semibold text-gray-900">Broker Details</h3>
|
||||
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-1">
|
||||
Name*
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
placeholder="Enter a Name"
|
||||
value={formData.name}
|
||||
onChange={(e) => setFormData({ ...formData, name: e.target.value })}
|
||||
className="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-teal-500"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-1">
|
||||
Select Broker
|
||||
</label>
|
||||
<select
|
||||
value={formData.broker}
|
||||
onChange={(e) => setFormData({ ...formData, broker: e.target.value })}
|
||||
className="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-teal-500"
|
||||
>
|
||||
<option value="">Select Broker</option>
|
||||
<option value="Masak">Masak</option>
|
||||
<option value="AngelOne">AngelOne</option>
|
||||
<option value="Zerodha">Zerodha</option>
|
||||
<option value="Dhan">Dhan</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* API Details */}
|
||||
<div className="space-y-4">
|
||||
<div className="flex items-center justify-between">
|
||||
<h3 className="font-semibold text-gray-900">API Details</h3>
|
||||
{slideMode === 'edit' && (
|
||||
<button className="text-sm text-teal-500 hover:text-teal-600">
|
||||
Update Key 🔄
|
||||
</button>
|
||||
)}
|
||||
{slideMode === 'add' && (
|
||||
<button className="text-sm text-teal-500 hover:text-teal-600">
|
||||
Help me connect to API
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-1">
|
||||
API Key
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
placeholder="api_key_1234567890abcdef"
|
||||
value={formData.apiKey}
|
||||
onChange={(e) => setFormData({ ...formData, apiKey: e.target.value })}
|
||||
className="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-teal-500"
|
||||
/>
|
||||
{slideMode === 'edit' && selectedBroker && (
|
||||
<p className="text-xs text-gray-500 mt-1">Date Created: {selectedBroker.dateCreated}</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-1">
|
||||
Secret API Key
|
||||
</label>
|
||||
<input
|
||||
type="password"
|
||||
placeholder="sk_412345LH..."
|
||||
value={formData.secretKey}
|
||||
onChange={(e) => setFormData({ ...formData, secretKey: e.target.value })}
|
||||
className="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-teal-500"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Footer */}
|
||||
<div className="p-6 border-t flex gap-3">
|
||||
<button
|
||||
onClick={() => setIsSlideOpen(false)}
|
||||
className="flex-1 px-4 py-2 border border-gray-300 rounded-lg hover:bg-gray-50 transition-colors"
|
||||
>
|
||||
Cancel
|
||||
</button>
|
||||
<button
|
||||
onClick={handleSubmit}
|
||||
className="flex-1 px-4 py-2 bg-teal-500 hover:bg-teal-600 text-white rounded-lg transition-colors"
|
||||
>
|
||||
{slideMode === 'add' ? 'Add' : 'Save'}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
6
src/app/Positions/page.js
Normal file
@ -0,0 +1,6 @@
|
||||
|
||||
export default function Positions() {
|
||||
return (
|
||||
<div>Positions</div>
|
||||
)
|
||||
}
|
||||
6
src/app/Scan_Tracks/page.js
Normal file
@ -0,0 +1,6 @@
|
||||
|
||||
export default function Scan_Tracks() {
|
||||
return (
|
||||
<div>Scan & Tracks</div>
|
||||
)
|
||||
}
|
||||
BIN
src/app/assets/HookNestLogo.png
Normal file
|
After Width: | Height: | Size: 4.9 KiB |
32
src/app/components/NavList.jsx
Normal file
@ -0,0 +1,32 @@
|
||||
"use client";
|
||||
import Link from "next/link";
|
||||
import { usePathname } from "next/navigation";
|
||||
import { motion } from "framer-motion";
|
||||
|
||||
export default function NavList({ list_items }) {
|
||||
const pathname = usePathname();
|
||||
|
||||
return (
|
||||
<nav className="h-fit relative grid items-center ">
|
||||
<ul className="flex space-x-6 relative">
|
||||
{list_items.map((item, index) => {
|
||||
const isActive = pathname === item.routeLink;
|
||||
return (
|
||||
<li key={index} className="relative">
|
||||
<Link href={item.routeLink} className={`${isActive && "text-blue-500"}`}>
|
||||
{item.name}
|
||||
</Link>
|
||||
|
||||
{isActive && (
|
||||
<motion.div
|
||||
layoutId="header-underline"
|
||||
className="absolute -bottom-5 left-0 right-0 h-[3px] bg-blue-500 rounded"
|
||||
/>
|
||||
)}
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
</nav>
|
||||
);
|
||||
}
|
||||
27
src/app/constants/broker.js
Normal file
@ -0,0 +1,27 @@
|
||||
export const BROKER_OPTIONS = ['Masak', 'AngelOne', 'Zerodha', 'Dhan'];
|
||||
|
||||
export const STATUS_TYPES = {
|
||||
ACTIVE: 'active',
|
||||
INACTIVE: 'inactive',
|
||||
EXPIRED: 'expired',
|
||||
};
|
||||
|
||||
export const STATUS_COLORS = {
|
||||
[STATUS_TYPES.ACTIVE]: 'bg-green-500',
|
||||
[STATUS_TYPES.EXPIRED]: 'bg-red-500',
|
||||
[STATUS_TYPES.INACTIVE]: 'bg-yellow-500',
|
||||
};
|
||||
|
||||
export const INITIAL_BROKERS = [
|
||||
{
|
||||
id: 'BR301',
|
||||
name: 'Techbonds Markets',
|
||||
broker: 'Masak',
|
||||
dateAdded: 'Feb 16, 2025',
|
||||
status: 'active',
|
||||
balance: '$978.50',
|
||||
apiKey: 'api_key_123456789abcdef',
|
||||
secretKey: 'sk_412345LH...',
|
||||
dateCreated: '04/12/2025',
|
||||
},
|
||||
];
|
||||
BIN
src/app/favicon.ico
Normal file
|
After Width: | Height: | Size: 25 KiB |
87
src/app/globals.css
Normal file
@ -0,0 +1,87 @@
|
||||
@import "tailwindcss";
|
||||
|
||||
@theme {
|
||||
/* Gray */
|
||||
--color-gray-50: #f9fafb;
|
||||
--color-gray-100: #f3f4f6;
|
||||
--color-gray-200: #e5e7eb;
|
||||
--color-gray-300: #d1d5db;
|
||||
--color-gray-400: #9ca3af;
|
||||
--color-gray-500: #6b7280;
|
||||
--color-gray-600: #4b5563;
|
||||
--color-gray-700: #374151;
|
||||
--color-gray-800: #1f2937;
|
||||
--color-gray-900: #111827;
|
||||
|
||||
/* Red */
|
||||
--color-red-50: #fef2f2;
|
||||
--color-red-100: #fee2e2;
|
||||
--color-red-200: #fecaca;
|
||||
--color-red-300: #fca5a5;
|
||||
--color-red-400: #f87171;
|
||||
--color-red-500: #ef4444;
|
||||
--color-red-600: #dc2626;
|
||||
--color-red-700: #b91c1c;
|
||||
--color-red-800: #991b1b;
|
||||
--color-red-900: #7f1d1d;
|
||||
|
||||
/* Green */
|
||||
--color-green-50: #f0fdf4;
|
||||
--color-green-100: #dcfce7;
|
||||
--color-green-200: #bbf7d0;
|
||||
--color-green-300: #86efac;
|
||||
--color-green-400: #4ade80;
|
||||
--color-green-500: #22c55e;
|
||||
--color-green-600: #16a34a;
|
||||
--color-green-700: #15803d;
|
||||
--color-green-800: #166534;
|
||||
--color-green-900: #14532d;
|
||||
|
||||
/* Blue */
|
||||
--color-blue-50: #eff6ff;
|
||||
--color-blue-100: #dbeafe;
|
||||
--color-blue-200: #bfdbfe;
|
||||
--color-blue-300: #93c5fd;
|
||||
--color-blue-400: #60a5fa;
|
||||
--color-blue-500: #3b82f6;
|
||||
--color-blue-600: #2563eb;
|
||||
--color-blue-700: #1d4ed8;
|
||||
--color-blue-800: #1e40af;
|
||||
--color-blue-900: #1e3a8a;
|
||||
|
||||
/* Yellow */
|
||||
--color-yellow-50: #fefce8;
|
||||
--color-yellow-100: #fef9c3;
|
||||
--color-yellow-200: #fef08a;
|
||||
--color-yellow-300: #fde047;
|
||||
--color-yellow-400: #facc15;
|
||||
--color-yellow-500: #eab308;
|
||||
--color-yellow-600: #ca8a04;
|
||||
--color-yellow-700: #a16207;
|
||||
--color-yellow-800: #854d0e;
|
||||
--color-yellow-900: #713f12;
|
||||
|
||||
/* Purple */
|
||||
--color-purple-50: #faf5ff;
|
||||
--color-purple-100: #f3e8ff;
|
||||
--color-purple-200: #e9d5ff;
|
||||
--color-purple-300: #d8b4fe;
|
||||
--color-purple-400: #c084fc;
|
||||
--color-purple-500: #a855f7;
|
||||
--color-purple-600: #9333ea;
|
||||
--color-purple-700: #7e22ce;
|
||||
--color-purple-800: #6b21a8;
|
||||
--color-purple-900: #581c87;
|
||||
|
||||
/* Orange */
|
||||
--color-orange-50: #fff7ed;
|
||||
--color-orange-100: #ffedd5;
|
||||
--color-orange-200: #fed7aa;
|
||||
--color-orange-300: #fdba74;
|
||||
--color-orange-400: #fb923c;
|
||||
--color-orange-500: #f97316;
|
||||
--color-orange-600: #ea580c;
|
||||
--color-orange-700: #c2410c;
|
||||
--color-orange-800: #9a3412;
|
||||
--color-orange-900: #7c2d12;
|
||||
}
|
||||
31
src/app/layout.js
Normal file
@ -0,0 +1,31 @@
|
||||
import "./globals.css";
|
||||
import { Geist, Geist_Mono } from "next/font/google";
|
||||
import Header from "./layouts/Header";
|
||||
const geistSans = Geist({
|
||||
variable: "--font-geist-sans",
|
||||
subsets: ["latin"],
|
||||
});
|
||||
|
||||
const geistMono = Geist_Mono({
|
||||
variable: "--font-geist-mono",
|
||||
subsets: ["latin"],
|
||||
});
|
||||
|
||||
export const metadata = {
|
||||
title: "Create Next App",
|
||||
description: "Generated by create next app",
|
||||
};
|
||||
|
||||
export default function RootLayout({ children }) {
|
||||
return (
|
||||
<html lang="en">
|
||||
<body className={`${geistSans.variable} ${geistMono.variable}`}>
|
||||
<div className="p-5">
|
||||
<Header/>
|
||||
</div>
|
||||
<main className="p-6">{children}</main>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
27
src/app/layouts/Header.jsx
Normal file
@ -0,0 +1,27 @@
|
||||
import NavList from "../components/NavList";
|
||||
|
||||
import Image from "next/image";
|
||||
import logo from '../assets/HookNestLogo.png'
|
||||
|
||||
export default function Header(){
|
||||
const list_items=[
|
||||
{id:1,name:"Dashboard",routeLink:"/"},
|
||||
{id:2,name:"Brokers",routeLink:"/Brokers"},
|
||||
{id:3,name:"Scan & Tracks",routeLink:"/Scan_Tracks"},
|
||||
{id:4,name:"Positions",routeLink:"/Positions"},
|
||||
{id:5,name:"AI Strategy Builder",routeLink:"/AIStrategyBuilder"},
|
||||
]
|
||||
return (
|
||||
<div className="relative flex justify-between items-center bg-gray-300 p-2 rounded-4xl">
|
||||
<Image
|
||||
src={logo}
|
||||
alt="App Logo"
|
||||
width={130}
|
||||
height={100}
|
||||
className="rounded-4xl"
|
||||
/>
|
||||
<NavList list_items={list_items}/>
|
||||
<div>Icons</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
6
src/app/page.js
Normal file
@ -0,0 +1,6 @@
|
||||
|
||||
export default function Dashboard() {
|
||||
return (
|
||||
<div>Dashboard</div>
|
||||
);
|
||||
}
|
||||