@3rdshot/shared-packages
v1.2.1
Published
Comprehensive shared package containing constants, components, utilities, and types for 3rdshot tournament applications
Downloads
47
Maintainers
Readme
@3rdshot/shared-packages
Comprehensive shared package containing constants, components, utilities, hooks, and types for all 3rdshot tournament applications.
Installation
npm install @3rdshot/shared-packagesPackage Structure
@3rdshot/shared-packages/
├── src/
│ ├── utils/ # Constants, enums, utilities
│ ├── components/ # Shared React components
│ ├── hooks/ # Custom React hooks
│ ├── types.ts # TypeScript interfaces
│ └── index.ts # Main exportsUsage
🔧 Constants & Utilities
import { countries, getCountryByCode, Roles, MatchesStatus } from '@3rdshot/shared-packages';
// Countries for phone input
const CountrySelect = () => (
<select>
{countries.map((country) => (
<option key={country.code} value={country.dial_code}>
{country.flag} {country.dial_code}
</option>
))}
</select>
);
// Enums
if (user.role === Roles.Admin) {
// Admin logic
}
const match = {
status: MatchesStatus.InProgress,
sport: SportsType.Pickleball
};📦 Modular Imports
// Import specific modules
import { Constants, Types } from '@3rdshot/shared-packages';
// Or import directly from modules
import { countries } from '@3rdshot/shared-packages/utils';
import { Country } from '@3rdshot/shared-packages/types';🧩 Components (Future)
// Will be available in future versions
import {
PhoneLogin,
OtpVerification,
Layout,
CountrySelect
} from '@3rdshot/shared-packages';🎣 Hooks (Future)
// Will be available in future versions
import {
useAuth,
useCountries,
useDebounce
} from '@3rdshot/shared-packages';Available Exports
Current (v1.0.0)
Constants & Utilities
countries- Array of country objects with ISO codes, dial codes, and flagsgetCountryByCode(code)- Get country by ISO codegetCountryByDialCode(dialCode)- Get country by dial codegetCountriesByName()- Get countries sorted alphabetically
Enums
Roles- User role enum (Player, Admin, Organizer)MatchesStatus- Match status enum (Pending, InProgress, Completed)SportsType- Sports type enum (Pickleball, Paddle, Tennis, etc.)TournamentStatus- Tournament status enum (Draft, Active, Completed, Cancelled)
Types
Country- Country object interfaceSelectOption- Generic select option interface
Future Additions
Components (Planned)
PhoneLogin- Phone number input with country selectionOtpVerification- OTP verification componentLayout- Common application layoutCountrySelect- Standalone country selector
Hooks (Planned)
useAuth- Authentication state managementuseCountries- Country data managementuseDebounce- Input debouncinguseLocalStorage- Local storage state
Utilities (Planned)
- Date formatting functions
- Validation helpers
- API utilities
- Format helpers
TypeScript Support
Full TypeScript support with comprehensive type definitions.
import { Country, Roles, MatchesStatus } from '@3rdshot/shared-packages';
const myCountry: Country = {
code: 'IN',
name: 'India',
dial_code: '+91',
flag: '🇮🇳'
};
const user: { role: Roles } = {
role: Roles.Admin
};Usage Across Applications
Tournament Management
import { countries, Roles } from '@3rdshot/shared-packages';
// Use in admin panels, user managementMatch Management (DUPR Draw Master)
import { countries, SportsType } from '@3rdshot/shared-packages';
// Use in match creation, player managementAuction Management
import { countries, TournamentStatus } from '@3rdshot/shared-packages';
// Use in auction setup, bidding interfaceDevelopment Workflow
Adding New Utilities
- Add to
src/utils/directory - Export from
src/utils/index.ts - Update version and rebuild
Adding New Components
- Add to
src/components/directory - Export from
src/components/index.ts - Uncomment export in main
src/index.ts
Adding New Hooks
- Add to
src/hooks/directory - Export from
src/hooks/index.ts - Uncomment export in main
src/index.ts
Version Management
- Patch: Bug fixes, small updates (1.0.1)
- Minor: New features, new exports (1.1.0)
- Major: Breaking changes (2.0.0)
Repository Structure
This package is maintained within the tournament-management workspace at:
tournament_management/
├── shared-packages/
│ └── 3rdshot-shared-packages/
├── src/ # Main tournament app
├── dupr-draw-master/ # Match management app
└── auction_management/ # Auction app