checkpoint before trying to fix sliders
This commit is contained in:
@@ -96,32 +96,6 @@ const FeedbackWeighting = ({ onComplete, onCancel }) => {
|
||||
}
|
||||
};
|
||||
|
||||
const getWeightLabel = (weight) => {
|
||||
const labels = {
|
||||
0: 'Ignore',
|
||||
1: 'Very Low',
|
||||
2: 'Low',
|
||||
3: 'Medium',
|
||||
4: 'High',
|
||||
5: 'Very High',
|
||||
6: 'Essential'
|
||||
};
|
||||
return labels[weight] || 'Medium';
|
||||
};
|
||||
|
||||
const getWeightColor = (weight) => {
|
||||
const colors = {
|
||||
0: 'bg-gray-200 text-gray-700',
|
||||
1: 'bg-red-100 text-red-700',
|
||||
2: 'bg-orange-100 text-orange-700',
|
||||
3: 'bg-yellow-100 text-yellow-700',
|
||||
4: 'bg-blue-100 text-blue-700',
|
||||
5: 'bg-indigo-100 text-indigo-700',
|
||||
6: 'bg-purple-100 text-purple-700'
|
||||
};
|
||||
return colors[weight] || 'bg-yellow-100 text-yellow-700';
|
||||
};
|
||||
|
||||
if (loading) {
|
||||
return (
|
||||
<div className="bg-white rounded-lg shadow-md p-6 mb-6">
|
||||
@@ -136,9 +110,8 @@ const FeedbackWeighting = ({ onComplete, onCancel }) => {
|
||||
return (
|
||||
<div className="bg-white rounded-lg shadow-md p-6 mb-6">
|
||||
<div className="flex justify-between items-center mb-6">
|
||||
<h2 className="text-2xl font-bold text-gray-800">
|
||||
<i className="fas fa-balance-scale mr-2 text-blue-500"></i>
|
||||
Weight Feedback Themes
|
||||
<h2 className="text-xl font-bold text-gray-800">
|
||||
Rate Feedback Words
|
||||
</h2>
|
||||
<button
|
||||
onClick={onCancel}
|
||||
@@ -149,11 +122,6 @@ const FeedbackWeighting = ({ onComplete, onCancel }) => {
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<p className="text-gray-600 mb-6">
|
||||
Rate how much each theme should influence future prompt generation.
|
||||
Higher weights mean the theme will have more influence.
|
||||
</p>
|
||||
|
||||
{error && (
|
||||
<div className="bg-red-50 border-l-4 border-red-400 p-4 mb-6">
|
||||
<div className="flex">
|
||||
@@ -167,97 +135,83 @@ const FeedbackWeighting = ({ onComplete, onCancel }) => {
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="space-y-6">
|
||||
<div className="space-y-4">
|
||||
{feedbackWords.map((item, index) => (
|
||||
<div key={item.key} className="border border-gray-200 rounded-lg p-4">
|
||||
<div className="flex justify-between items-center mb-3">
|
||||
<div>
|
||||
<span className="text-sm font-medium text-gray-500">
|
||||
Theme {index + 1}
|
||||
</span>
|
||||
<h3 className="text-lg font-semibold text-gray-800">
|
||||
{item.word}
|
||||
</h3>
|
||||
</div>
|
||||
<div className={`px-3 py-1 rounded-full text-sm font-medium ${getWeightColor(weights[item.word] || 3)}`}>
|
||||
{getWeightLabel(weights[item.word] || 3)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<input
|
||||
type="range"
|
||||
min="0"
|
||||
max="6"
|
||||
value={weights[item.word] || 3}
|
||||
onChange={(e) => handleWeightChange(item.word, parseInt(e.target.value))}
|
||||
className="w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer"
|
||||
/>
|
||||
<div className="flex justify-between text-xs text-gray-500">
|
||||
<span>Ignore (0)</span>
|
||||
<span>Medium (3)</span>
|
||||
<span>Essential (6)</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex justify-between mt-4">
|
||||
<div className="flex space-x-2">
|
||||
{[0, 1, 2, 3, 4, 5, 6].map(weight => (
|
||||
<button
|
||||
key={weight}
|
||||
onClick={() => handleWeightChange(item.word, weight)}
|
||||
className={`px-3 py-1 text-sm rounded ${
|
||||
(weights[item.word] || 3) === weight
|
||||
? 'bg-blue-500 text-white'
|
||||
: 'bg-gray-100 text-gray-700 hover:bg-gray-200'
|
||||
}`}
|
||||
>
|
||||
{weight}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
<div className="text-sm text-gray-500">
|
||||
Current: <span className="font-semibold">{weights[item.word] || 3}</span>
|
||||
</div>
|
||||
<div className="mb-3">
|
||||
<h3 className="text-lg font-semibold text-gray-800 mb-2">
|
||||
{item.word}
|
||||
</h3>
|
||||
<div className="relative">
|
||||
<input
|
||||
type="range"
|
||||
min="0"
|
||||
max="6"
|
||||
value={weights[item.word] || 3}
|
||||
onChange={(e) => handleWeightChange(item.word, parseInt(e.target.value))}
|
||||
className="w-full h-8 bg-gray-200 rounded-lg appearance-none cursor-pointer slider-thumb-hidden"
|
||||
style={{
|
||||
background: `linear-gradient(to right, #ef4444 0%, #f97316 16.67%, #eab308 33.33%, #22c55e 50%, #3b82f6 66.67%, #8b5cf6 83.33%, #a855f7 100%)`
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="mt-8 pt-6 border-t border-gray-200">
|
||||
<div className="flex justify-between items-center">
|
||||
<div className="text-sm text-gray-500">
|
||||
<i className="fas fa-info-circle mr-1"></i>
|
||||
Your ratings will influence future prompt generation
|
||||
</div>
|
||||
<div className="flex space-x-3">
|
||||
<button
|
||||
onClick={onCancel}
|
||||
className="px-4 py-2 border border-gray-300 rounded-md text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500"
|
||||
disabled={submitting}
|
||||
>
|
||||
Cancel
|
||||
</button>
|
||||
<button
|
||||
onClick={handleSubmit}
|
||||
disabled={submitting}
|
||||
className="px-4 py-2 bg-blue-500 text-white rounded-md hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
>
|
||||
{submitting ? (
|
||||
<>
|
||||
<i className="fas fa-spinner fa-spin mr-2"></i>
|
||||
Submitting...
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<i className="fas fa-check mr-2"></i>
|
||||
Submit Ratings
|
||||
</>
|
||||
)}
|
||||
</button>
|
||||
</div>
|
||||
<div className="flex justify-end space-x-3">
|
||||
<button
|
||||
onClick={onCancel}
|
||||
className="px-4 py-2 border border-gray-300 rounded-md text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500"
|
||||
disabled={submitting}
|
||||
>
|
||||
Cancel
|
||||
</button>
|
||||
<button
|
||||
onClick={handleSubmit}
|
||||
disabled={submitting}
|
||||
className="px-4 py-2 bg-blue-500 text-white rounded-md hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
>
|
||||
{submitting ? (
|
||||
<>
|
||||
<i className="fas fa-spinner fa-spin mr-2"></i>
|
||||
Submitting...
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<i className="fas fa-check mr-2"></i>
|
||||
Submit
|
||||
</>
|
||||
)}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style jsx>{`
|
||||
.slider-thumb-hidden::-webkit-slider-thumb {
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
background: #3b82f6;
|
||||
border-radius: 50%;
|
||||
cursor: pointer;
|
||||
border: 2px solid white;
|
||||
box-shadow: 0 2px 4px rgba(0,0,0,0.2);
|
||||
}
|
||||
|
||||
.slider-thumb-hidden::-moz-range-thumb {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
background: #3b82f6;
|
||||
border-radius: 50%;
|
||||
cursor: pointer;
|
||||
border: 2px solid white;
|
||||
box-shadow: 0 2px 4px rgba(0,0,0,0.2);
|
||||
}
|
||||
`}</style>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -15,7 +15,7 @@ import '../styles/global.css';
|
||||
<nav>
|
||||
<div class="logo">
|
||||
<i class="fas fa-book-open"></i>
|
||||
<h1>Daily Journal Prompt Generator</h1>
|
||||
<h1>daily-journal-prompt</h1>
|
||||
</div>
|
||||
<div class="nav-links">
|
||||
<a href="/"><i class="fas fa-home"></i> Home</a>
|
||||
|
||||
@@ -6,11 +6,6 @@ import StatsDashboard from '../components/StatsDashboard.jsx';
|
||||
|
||||
<Layout>
|
||||
<div class="container">
|
||||
<div class="text-center mb-4">
|
||||
<h1><i class="fas fa-magic"></i> daily-journal-prompt</h1>
|
||||
<p class="mt-2">A writing prompt generator meant for semi-offline use in daily journaling</p>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 lg:grid-cols-3 gap-4">
|
||||
<div class="lg:col-span-2">
|
||||
<div class="card">
|
||||
|
||||
Reference in New Issue
Block a user