Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions apps/web/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
const nextConfig = {
reactStrictMode: true,
transpilePackages: ['@stellar-rent/ui'],

// Suppress ESLint errors during production build to avoid "Unknown options" failure
eslint: {
ignoreDuringBuilds: true,
},

images: {
domains: ['images.unsplash.com'],
remotePatterns: [
Expand All @@ -13,32 +19,30 @@ const nextConfig = {
},
],
},
webpack: (config) => {

webpack: (config, { _isServer }) => {
// Fix for node modules and fallback modules
config.resolve.fallback = { fs: false, net: false, tls: false };

config.experiments = {
...config.experiments,
topLevelAwait: true,
};

config.resolve.alias = {
...config.resolve.alias,
'~': require('node:path').resolve(__dirname, 'src'),
'sodium-native': 'sodium-universal',
};

// ConfiguraciΓ³n para manejar mΓ³dulos nativos
// Handle native node modules
config.module.rules.push({
test: /\.node$/,
use: 'node-loader',
});

// ConfiguraciΓ³n para manejar dependencias dinΓ‘micas
config.module.unknownContextCritical = false;

// ConfiguraciΓ³n especΓ­fica para el SDK de Stellar
config.resolve.alias = {
...config.resolve.alias,
'sodium-native': 'sodium-universal',
};

return config;
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export const AddPropertyModal: React.FC<AddPropertyModalProps> = ({
</button>
</div>

<form onSubmit={onSubmit} className="space-y-6 ">
<form onSubmit={onSubmit} className="space-y-6">
<div className="border-b border-gray-200 pb-6">
<h3 className="text-lg font-semibold dark:text-white text-gray-900 mb-4">
Basic Information
Expand All @@ -92,8 +92,8 @@ export const AddPropertyModal: React.FC<AddPropertyModalProps> = ({
type="text"
required
value={newProperty.title}
onChange={(e) => setNewProperty({ ...newProperty, title: e.target.value })}
className="w-full px-3 py-2 border dark:text-white text-black border-gray-300 rounded-lg bg-transparent "
onChange={(e) => setNewProperty((prev) => ({ ...prev, title: e.target.value }))}
className="w-full px-3 py-2 border dark:text-white text-black border-gray-300 rounded-lg bg-transparent"
placeholder="Enter a catchy title for your property"
/>
</div>
Expand All @@ -110,9 +110,9 @@ export const AddPropertyModal: React.FC<AddPropertyModalProps> = ({
required
value={newProperty.propertyType}
onChange={(e) =>
setNewProperty({ ...newProperty, propertyType: e.target.value })
setNewProperty((prev) => ({ ...prev, propertyType: e.target.value }))
}
className="w-full px-3 py-2 border dark:text-white border-gray-300 rounded-lg focus:ring-0 bg-transparent focus:ring-blue-500 focus:border-transparent"
className="w-full px-3 py-2 border dark:text-white border-gray-300 rounded-lg focus:ring-0 bg-transparent"
>
{propertyTypes.map((type) => (
<option key={type.value} value={type.value}>
Expand All @@ -134,8 +134,10 @@ export const AddPropertyModal: React.FC<AddPropertyModalProps> = ({
type="text"
required
value={newProperty.location}
onChange={(e) => setNewProperty({ ...newProperty, location: e.target.value })}
className="w-full px-3 py-2 border dark:text-white text-black border-gray-300 rounded-lg focus:ring-0 bg-transparent focus:ring-blue-500 focus:border-transparent"
onChange={(e) =>
setNewProperty((prev) => ({ ...prev, location: e.target.value }))
}
className="w-full px-3 py-2 border dark:text-white text-black border-gray-300 rounded-lg bg-transparent"
placeholder="City, State, Country"
/>
</div>
Expand All @@ -153,8 +155,8 @@ export const AddPropertyModal: React.FC<AddPropertyModalProps> = ({
required
min="1"
value={newProperty.price}
onChange={(e) => setNewProperty({ ...newProperty, price: e.target.value })}
className="w-full px-3 py-2 border dark:text-white border-gray-300 rounded-lg focus:ring-0 bg-transparent focus:ring-blue-500 focus:border-transparent"
onChange={(e) => setNewProperty((prev) => ({ ...prev, price: e.target.value }))}
className="w-full px-3 py-2 border dark:text-white border-gray-300 rounded-lg bg-transparent"
placeholder="100"
/>
</div>
Expand All @@ -172,10 +174,10 @@ export const AddPropertyModal: React.FC<AddPropertyModalProps> = ({
rows={4}
value={newProperty.description}
onChange={(e) =>
setNewProperty({ ...newProperty, description: e.target.value })
setNewProperty((prev) => ({ ...prev, description: e.target.value }))
}
className="w-full px-3 py-2 dark:text-white border border-gray-300 rounded-lg focus:ring-0 bg-transparent focus:ring-blue-500 focus:border-transparent"
placeholder="Describe your property, its unique features, and what makes it special..."
className="w-full px-3 py-2 dark:text-white border border-gray-300 rounded-lg bg-transparent"
placeholder="Describe your property..."
/>
</div>
</div>
Expand All @@ -197,9 +199,12 @@ export const AddPropertyModal: React.FC<AddPropertyModalProps> = ({
id="bedrooms"
value={newProperty.bedrooms}
onChange={(e) =>
setNewProperty({ ...newProperty, bedrooms: Number.parseInt(e.target.value) })
setNewProperty((prev) => ({
...prev,
bedrooms: Number.parseInt(e.target.value),
}))
}
className="w-full px-3 py-2 border dark:text-white border-gray-300 rounded-lg focus:ring-0 bg-transparent focus:ring-blue-500 focus:border-transparent"
className="w-full px-3 py-2 border dark:text-white border-gray-300 rounded-lg bg-transparent"
>
{[1, 2, 3, 4, 5, 6, 7, 8].map((num) => (
<option key={num} value={num}>
Expand All @@ -220,9 +225,12 @@ export const AddPropertyModal: React.FC<AddPropertyModalProps> = ({
id="bathroom"
value={newProperty.bathrooms}
onChange={(e) =>
setNewProperty({ ...newProperty, bathrooms: Number.parseInt(e.target.value) })
setNewProperty((prev) => ({
...prev,
bathrooms: Number.parseInt(e.target.value),
}))
Comment on lines +228 to +231
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

find . -type f -name "AddPropertyModal.tsx" | head -5

Repository: Stellar-Rent/stellar-rent

Length of output: 144


🏁 Script executed:

wc -l ./apps/web/src/app/dashboard/host-dashboard/components/AddPropertyModal.tsx

Repository: Stellar-Rent/stellar-rent

Length of output: 148


🏁 Script executed:

cat -n ./apps/web/src/app/dashboard/host-dashboard/components/AddPropertyModal.tsx | sed -n '210,245p'

Repository: Stellar-Rent/stellar-rent

Length of output: 1650


🏁 Script executed:

cat -n ./apps/web/src/app/dashboard/host-dashboard/components/AddPropertyModal.tsx | sed -n '1,50p'

Repository: Stellar-Rent/stellar-rent

Length of output: 1441


Use parseFloat instead of parseInt to preserve decimal bathroom values.

The bathrooms select includes values like 1.5, 2.5, etc., but Number.parseInt truncates them to integers. Change to Number.parseFloat or Number to preserve decimal values.

πŸ› οΈ Suggested fix
-                        bathrooms: Number.parseInt(e.target.value),
+                        bathrooms: Number.parseFloat(e.target.value),
πŸ“ Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
setNewProperty((prev) => ({
...prev,
bathrooms: Number.parseInt(e.target.value),
}))
setNewProperty((prev) => ({
...prev,
bathrooms: Number.parseFloat(e.target.value),
}))
πŸ€– Prompt for AI Agents
In `@apps/web/src/app/dashboard/host-dashboard/components/AddPropertyModal.tsx`
around lines 228 - 231, The bathrooms handler currently uses Number.parseInt
which truncates decimal values; update the setNewProperty call that sets
bathrooms (the callback passed to setNewProperty) to parse the input with
Number.parseFloat (or Number) instead of Number.parseInt so values like "1.5"
and "2.5" are preserved (change the bathrooms: Number.parseInt(e.target.value)
line to use Number.parseFloat(e.target.value) or Number(e.target.value)).

}
className="w-full px-3 py-2 border dark:text-white border-gray-300 rounded-lg focus:ring-0 bg-transparent focus:ring-blue-500 focus:border-transparent"
className="w-full px-3 py-2 border dark:text-white border-gray-300 rounded-lg bg-transparent"
>
{[1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5].map((num) => (
<option key={num} value={num}>
Expand All @@ -243,9 +251,12 @@ export const AddPropertyModal: React.FC<AddPropertyModalProps> = ({
id="guest"
value={newProperty.guests}
onChange={(e) =>
setNewProperty({ ...newProperty, guests: Number.parseInt(e.target.value) })
setNewProperty((prev) => ({
...prev,
guests: Number.parseInt(e.target.value),
}))
}
className="w-full px-3 py-2 dark:text-white border border-gray-300 rounded-lg focus:ring-0 bg-transparent focus:ring-blue-500 focus:border-transparent"
className="w-full px-3 py-2 dark:text-white border border-gray-300 rounded-lg bg-transparent"
>
{[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 16].map((num) => (
<option key={num} value={num}>
Expand All @@ -268,7 +279,7 @@ export const AddPropertyModal: React.FC<AddPropertyModalProps> = ({
type="checkbox"
checked={newProperty.amenities.includes(amenity)}
onChange={() => onAmenityToggle(amenity)}
className="rounded border-gray-300 text-blue-600 focus:ring-blue-500"
className="rounded border-gray-300 text-blue-600"
/>
<span className="text-sm dark:text-white text-gray-700">{amenity}</span>
</label>
Expand All @@ -284,65 +295,21 @@ export const AddPropertyModal: React.FC<AddPropertyModalProps> = ({
rows={3}
id="rules"
value={newProperty.rules}
onChange={(e) => setNewProperty({ ...newProperty, rules: e.target.value })}
className="w-full px-3 py-2 border dark:text-white border-gray-300 rounded-lg focus:ring-0 bg-transparent focus:ring-blue-500 focus:border-transparent"
placeholder="No smoking, No pets, Quiet hours after 10 PM, etc."
onChange={(e) => setNewProperty((prev) => ({ ...prev, rules: e.target.value }))}
className="w-full px-3 py-2 border dark:text-white border-gray-300 rounded-lg bg-transparent"
placeholder="No smoking, No pets, etc."
/>
</div>

<div className="pb-6">
<h3 className="text-lg font-semibold dark:text-white text-gray-900 mb-4">Photos</h3>
<div className="border-2 border-dashed border-gray-300 rounded-lg p-8 text-center">
<div className="text-gray-500">
<svg
className="mx-auto h-12 w-12 text-gray-400"
stroke="currentColor"
fill="none"
viewBox="0 0 48 48"
aria-hidden="true"
>
<title>Upload photos</title>
<path
d="M28 8H12a4 4 0 00-4 4v20m32-12v8m0 0v8a4 4 0 01-4 4H12a4 4 0 01-4-4v-4m32-4l-3.172-3.172a4 4 0 00-5.656 0L28 28M8 32l9.172-9.172a4 4 0 015.656 0L28 28m0 0l4 4m4-24h8m-4-4v8m-12 4h.02"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
/>
</svg>
<div className="mt-4">
<label htmlFor="file-upload" className="cursor-pointer">
<span className="mt-2 block dark:text-white text-sm font-medium text-gray-900">
Upload property photos
</span>
<input
id="file-upload"
name="file-upload"
type="file"
className="sr-only"
multiple
accept="image/*"
/>
</label>
<p className="mt-1 text-xs dark:text-white text-gray-500">
PNG, JPG, GIF up to 10MB each
</p>
</div>
</div>
</div>
</div>

<div className="flex justify-end space-x-4 pt-6">
<button
type="button"
onClick={onClose}
className="px-6 py-2 dark:text-white border border-gray-300 text-gray-700 rounded-lg hover:bg-gray-50"
className="px-6 py-2 dark:text-white border border-gray-300 rounded-lg"
>
Cancel
</button>
<button
type="submit"
className="px-6 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700"
>
<button type="submit" className="px-6 py-2 bg-blue-600 text-white rounded-lg">
Add Property
</button>
</div>
Expand Down
Loading