Skip to content

Commit 5781be5

Browse files
committed
Dark mode done!
1 parent eb3b9fc commit 5781be5

17 files changed

Lines changed: 456 additions & 113 deletions

File tree

resources/js/Components/Form/PrimeVueFormError.vue

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ function formatError(error) {
2626
variant="simple"
2727
>
2828
<template v-for="error in errors" :key="error">
29-
<p>
30-
{{ formatError(error.toString()) }}
31-
</p>
29+
<p><span class="text-red-600 dark:text-red-400">{{ formatError(error.toString()) }}</span></p>
3230
</template>
3331
</Message>
3432
</template>

resources/js/Components/Form/TagSelector.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,11 +250,11 @@ onMounted(async () => {
250250
<span
251251
v-for="tag in selectedTags"
252252
:key="tag"
253-
class="inline-flex items-center mr-2 my-1 bg-secondary text-primaryDark dark:bg-gray-900 dark:text-primaryLight px-3 py-1 rounded-full text-sm font-medium transition-colors"
253+
class="inline-flex items-center mr-2 my-1 bg-secondary text-primaryDark dark:bg-gray-900 dark:text-white px-3 py-1 rounded-full text-sm font-medium transition-colors"
254254
>
255255
<button
256256
@click="removeTag(tag)"
257-
class="mr-2 text-primaryDark dark:text-primaryLight"
257+
class="mr-2 text-primaryDark dark:text-white"
258258
type="button"
259259
>
260260
<Icon :icon="'mdi:close'" />

resources/js/Components/ListInput.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script setup>
22
import { ref, watch } from "vue";
3-
import InputText from "primevue/inputtext";
43
import { Icon } from "@iconify/vue";
4+
import TextInput from "./TextInput.vue";
55
66
const emit = defineEmits(["change"]);
77
@@ -23,8 +23,8 @@ watch(
2323
() => props.initialValues,
2424
(newInitialValues) => {
2525
// Only update if the content is actually different to avoid unnecessary updates
26-
const currentFiltered = items.value.filter(item => item !== "");
27-
const newFiltered = newInitialValues.filter(item => item !== "");
26+
const currentFiltered = items.value.filter((item) => item !== "");
27+
const newFiltered = newInitialValues.filter((item) => item !== "");
2828
2929
if (JSON.stringify(currentFiltered) !== JSON.stringify(newFiltered)) {
3030
items.value = [...newInitialValues];
@@ -65,7 +65,7 @@ const updateItem = (index, value) => {
6565
:key="index"
6666
class="flex items-center gap-2"
6767
>
68-
<InputText
68+
<TextInput
6969
:value="item"
7070
@input="(event) => updateItem(index, event.target.value)"
7171
placeholder="Enter an item"
@@ -82,10 +82,10 @@ const updateItem = (index, value) => {
8282
</div>
8383

8484
<button
85+
v-if="items.length < maxSize"
8586
type="button"
8687
@click="addItem"
8788
class="flex items-center gap-1 text-blue-500 focus:outline-none"
88-
:disabled="items.length >= maxSize"
8989
>
9090
<Icon icon="mdi:plus" />
9191
<span>Add</span>

resources/js/Components/Resources/ResourceEdit/ResourceEdits.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const props = defineProps({
2323
<div
2424
v-for="edit in props.resourceEdits.data"
2525
:key="edit.id"
26-
class="bg-white/70 backdrop-blur-md p-6 rounded-lg shadow-md"
26+
class="bg-white/70 dark:bg-gray-900/90 backdrop-blur-md p-6 rounded-lg shadow-md border border-transparent dark:border-gray-800"
2727
>
2828
<div class="flex flex-row gap-4 items-center">
2929
<Upvotable
@@ -53,7 +53,7 @@ const props = defineProps({
5353
class="mt-2"
5454
/>
5555

56-
<p class="text-gray-700 mt-2">
56+
<p class="text-gray-700 dark:text-gray-300 mt-2">
5757
{{ edit.edit_description }}
5858
</p>
5959
</div>

resources/js/Components/Resources/Reviews/CreateResourceReview.vue

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,14 @@ const submitReview = async () => {
116116

117117
<template>
118118
<div
119-
class="mx-auto bg-white shadow-lg rounded-2xl p-6 relative"
119+
class="mx-auto bg-white dark:bg-gray-900 shadow-lg rounded-2xl p-6 relative border border-transparent dark:border-gray-800"
120120
>
121121
<FormSaverChip
122122
:is-saved="isSavedToLocalStorage"
123123
:has-content="hasFormContent"
124124
/>
125125

126-
<h2 class="text-2xl font-semibold mb-6">
126+
<h2 class="text-2xl font-semibold mb-6 text-gray-900 dark:text-gray-100">
127127
{{ isEditingMode ? "Update Review" : "Write a Review" }}
128128
</h2>
129129

@@ -140,11 +140,11 @@ const submitReview = async () => {
140140
<InputText
141141
v-model="form.title"
142142
placeholder="Review title"
143-
class="w-full rounded-md border-gray-300 mt-1"
143+
class="w-full rounded-md border-gray-300 dark:border-gray-800 mt-1 dark:bg-gray-900 dark:text-gray-100"
144144
/>
145145
<PrimeVueFormError
146-
v-if="$field.invalid"
147-
:errors="$field.errors"
146+
v-if="errors.title"
147+
:errors="errors.title"
148148
/>
149149
</FormField>
150150

@@ -156,11 +156,11 @@ const submitReview = async () => {
156156
v-model="form.description"
157157
placeholder="Write your thoughts..."
158158
rows="4"
159-
class="w-full rounded-md border-gray-300 mt-1"
159+
class="w-full rounded-md border-gray-300 dark:border-gray-800 mt-1 dark:bg-gray-900 dark:text-gray-100"
160160
/>
161161
<PrimeVueFormError
162-
v-if="$field.invalid"
163-
:errors="$field.errors"
162+
v-if="errors.description"
163+
:errors="errors.description"
164164
/>
165165
</FormField>
166166

@@ -178,8 +178,8 @@ const submitReview = async () => {
178178

179179
<Rating v-model="form.community" :cancel="false" />
180180
<PrimeVueFormError
181-
v-if="$field.invalid"
182-
:errors="$field.errors"
181+
v-if="errors.community"
182+
:errors="errors.community"
183183
/>
184184
</FormField>
185185

@@ -195,8 +195,8 @@ const submitReview = async () => {
195195

196196
<Rating v-model="form.teaching_clarity" :cancel="false" />
197197
<PrimeVueFormError
198-
v-if="$field.invalid"
199-
:errors="$field.errors"
198+
v-if="errors.teaching_clarity"
199+
:errors="errors.teaching_clarity"
200200
/>
201201
</FormField>
202202

@@ -208,11 +208,10 @@ const submitReview = async () => {
208208
<span class="font-semibold mb-1" >
209209
Engagement <span class="text-red-500"> * </span></span
210210
>
211-
212211
<Rating v-model="form.engagement" :cancel="false" />
213212
<PrimeVueFormError
214-
v-if="$field.invalid"
215-
:errors="$field.errors"
213+
v-if="errors.engagement"
214+
:errors="errors.engagement"
216215
/>
217216
</FormField>
218217

@@ -228,8 +227,8 @@ const submitReview = async () => {
228227

229228
<Rating v-model="form.practicality" :cancel="false" />
230229
<PrimeVueFormError
231-
v-if="$field.invalid"
232-
:errors="$field.errors"
230+
v-if="errors.practicality"
231+
:errors="errors.practicality"
233232
/>
234233
</FormField>
235234

@@ -245,8 +244,8 @@ const submitReview = async () => {
245244

246245
<Rating v-model="form.user_friendliness" :cancel="false" />
247246
<PrimeVueFormError
248-
v-if="$field.invalid"
249-
:errors="$field.errors"
247+
v-if="errors.user_friendliness"
248+
:errors="errors.user_friendliness"
250249
/>
251250
</FormField>
252251

@@ -261,45 +260,47 @@ const submitReview = async () => {
261260

262261
<Rating v-model="form.updates" :cancel="false" />
263262
<PrimeVueFormError
264-
v-if="$field.invalid"
265-
:errors="$field.errors"
263+
v-if="errors.updates"
264+
:errors="errors.updates"
266265
/>
267266
</FormField>
268267
</div>
269268

270269
<!-- Pros and Cons side by side -->
271270
<div class="flex flex-col md:flex-row gap-6 mt-6">
272271
<FormField v-slot="$field" name="pros" class="flex-1">
273-
<label class="font-semibold">Pros</label>
272+
<label class="font-semibold text-gray-900 dark:text-gray-100">Pros</label>
274273
<ListInput
275274
:maxSize="10"
276275
:initialValues="form.pros"
277276
@change="(val) => (form.pros = val)"
277+
class="dark:bg-gray-900 dark:text-gray-100 dark:border-gray-800"
278278
/>
279279
<PrimeVueFormError
280-
v-if="$field.invalid"
281-
:errors="$field.errors"
280+
v-if="errors.pros"
281+
:errors="errors.pros"
282282
/>
283283
</FormField>
284284

285285
<FormField v-slot="$field" name="cons" class="flex-1">
286-
<label class="font-semibold">Cons</label>
286+
<label class="font-semibold text-gray-900 dark:text-gray-100">Cons</label>
287287
<ListInput
288288
:maxSize="10"
289289
:initialValues="form.cons"
290290
@change="(val) => (form.cons = val)"
291+
class="dark:bg-gray-900 dark:text-gray-100 dark:border-gray-800"
291292
/>
292293
<PrimeVueFormError
293-
v-if="$field.invalid"
294-
:errors="$field.errors"
294+
v-if="errors.cons"
295+
:errors="errors.cons"
295296
/>
296297
</FormField>
297298
</div>
298299

299300
<!-- Check if not auth since unauthed user will always fail (need to be logged in) -->
300301
<div
301302
v-if="error && $page.props.auth.user"
302-
class="text-red-500 bg-red-100 p-3 rounded-md"
303+
class="text-red-500 bg-red-100 dark:bg-red-900 p-3 rounded-md"
303304
>
304305
{{ error }}
305306
</div>
@@ -309,7 +310,7 @@ const submitReview = async () => {
309310
<Button
310311
type="submit"
311312
:label="isEditingMode ? 'Update Review' : 'Submit Review'"
312-
class="bg-primaryDark text-white rounded-lg px-6 py-2 mt-4"
313+
class="bg-primaryDark text-white rounded-lg px-6 py-2 mt-4 hover:bg-primary focus:bg-primaryDark/90 dark:bg-primaryDark dark:text-white"
313314
:disabled="isSubmitting"
314315
/>
315316
</div>

resources/js/Components/Resources/SubmissionGuidelines.vue

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<template>
2-
<h3 class="text-lg font-semibold mb-4 text-gray-800">
2+
<h3 class="text-lg font-semibold mb-4 text-gray-800 dark:text-gray-100">
33
Submission Guidelines
44
</h3>
5-
<div class="space-y-4 text-sm text-gray-700">
6-
<div class="space-y-4 text-sm text-gray-700">
5+
<div class="space-y-4 text-sm text-gray-700 dark:text-gray-300">
6+
<div class="space-y-4 text-sm text-gray-700 dark:text-gray-300">
77
<div>
8-
<h4 class="font-bold text-gray-800 mb-2">Resource Scope</h4>
8+
<h4 class="font-bold text-gray-800 dark:text-gray-100 mb-2">Resource Scope</h4>
99
<p class="mb-2">
1010
This site features comprehensive learning resources rather
1111
than isolated materials. Resources should provide ongoing
@@ -20,7 +20,7 @@
2020
</div>
2121

2222
<div>
23-
<h4 class="font-bold text-gray-800 mb-2">
23+
<h4 class="font-bold text-gray-800 dark:text-gray-100 mb-2">
2424
Types of Content Accepted
2525
</h4>
2626
<ul class="list-disc list-inside space-y-1 text-xs">
@@ -51,7 +51,7 @@
5151
</div>
5252

5353
<div>
54-
<h4 class="font-bold text-gray-800 mb-2">Exceptions</h4>
54+
<h4 class="font-bold text-gray-800 dark:text-gray-100 mb-2">Exceptions</h4>
5555
<ul class="list-disc list-inside space-y-1 text-xs">
5656
<li>
5757
An individual book may be included if it is
@@ -72,7 +72,7 @@
7272
</div>
7373

7474
<div>
75-
<h4 class="font-bold text-gray-800 mb-2">
75+
<h4 class="font-bold text-gray-800 dark:text-gray-100 mb-2">
7676
What's Not Included
7777
</h4>
7878
<ul class="list-disc list-inside space-y-1 text-xs">

resources/js/Components/StarRating/StarRating.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ const getStarClass = (type) =>
2121
({
2222
full: "text-orange-500",
2323
half: "text-orange-500",
24-
empty: "text-gray-400",
24+
empty: "text-gray-400 dark:text-gray-500",
2525
}[type]);
2626
</script>
2727

2828
<template>
2929
<div class="inline-flex items-center flex-wrap gap-1">
30-
<span class="text-sm font-medium text-gray-600">
30+
<span class="text-sm font-medium text-gray-600 dark:text-gray-200">
3131
{{ formattedRating }}
3232
</span>
3333
<div class="inline-flex items-center">

resources/js/Helpers/labels.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ export const platformLabels = {
3838
};
3939

4040
export const pricingsObject = [
41-
{ label: "Free", value: "free" },
42-
{ label: "Paid", value: "paid" },
43-
{ label: "Freemium", value: "freemium" },
44-
{ label: "Premium", value: "premium" },
41+
{ label: "Free - No cost ever!", value: "free" },
42+
{ label: "Paid - One time fee", value: "paid" },
43+
{ label: "Freemium - Some parts free, other parts require a subscription", value: "freemium" },
44+
{ label: "Premium - Requires a subscription", value: "premium" },
4545
];
4646

4747
export const pricingLabels = {

resources/js/Helpers/validation.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const resourceMandatoryFields = object({
1010
.required("URL is required"),
1111
platforms: array().of(string()).min(1, "At least one platform is required"),
1212
description: string().required("Description is required").max(10000),
13-
difficulty: array().of(string()).min(1, "Difficulty level is required"),
13+
difficulties: array().of(string()).min(1, "Difficulty level is required"),
1414
pricing: string().required("Pricing information is required"),
1515
});
1616

@@ -61,6 +61,8 @@ export const resourceReviewFields = object({
6161
.required("Updates rating is required.")
6262
.min(1, "Minimum is 1.")
6363
.max(5, "Maximum is 5."),
64+
65+
// TODO: THIS VALIDATION DOES NTO WORK CORRECTLY
6466
pros: array()
6567
.transform((_value, originalValue) => {
6668
// Handle case where PrimeVue might pass a string instead of array
@@ -102,7 +104,7 @@ export const nullableResourceFields = object({
102104
// No validation on image_file since it will be validated on backend
103105
platforms: array().of(string()),
104106
description: string().max(10000),
105-
difficulty: array().of(string()),
107+
difficulties: array().of(string()),
106108
pricing: string(),
107109
topic_tags: array()
108110
.of(string().max(50))

0 commit comments

Comments
 (0)