Skip to content

Commit 6cc6142

Browse files
committed
♻️ refactor: 优化课表与课程管理体验
1 parent 1a11109 commit 6cc6142

3 files changed

Lines changed: 44 additions & 28 deletions

File tree

app/(pages)/settings/course/add.tsx

Lines changed: 35 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -390,34 +390,45 @@ export default function AddEditCourseScreen() {
390390
</Text>
391391
</Pressable>
392392

393-
<Pressable
394-
onPress={handleSave}
395-
className="items-center rounded-xl bg-blue-500 py-3.5 active:bg-blue-600"
396-
>
397-
<Text className="text-base font-semibold text-white">
398-
{t("common.save")}
399-
</Text>
400-
</Pressable>
393+
{isEdit ? (
394+
<View className="flex-row gap-3">
395+
<Pressable
396+
onPress={handleSave}
397+
className="flex-1 flex-row items-center justify-center rounded-xl bg-blue-500 py-3.5 active:bg-blue-600"
398+
>
399+
<Ionicons name="save-outline" size={18} color="#ffffff" />
400+
<Text className="ml-1.5 text-base font-semibold text-white">
401+
{t("common.save")}
402+
</Text>
403+
</Pressable>
401404

402-
{isEdit && (
403-
<Pressable
404-
onPress={() => setShareVisible(true)}
405-
className="mt-3 flex-row items-center justify-center rounded-xl bg-white py-3.5 active:bg-neutral-50 dark:bg-neutral-800 dark:active:bg-neutral-700"
406-
>
407-
<Ionicons name="qr-code-outline" size={18} color="#3b82f6" />
408-
<Text className="ml-1.5 text-base font-medium text-blue-500">
409-
{t("schedule.shareCourse")}
410-
</Text>
411-
</Pressable>
412-
)}
405+
<Pressable
406+
onPress={() => setShareVisible(true)}
407+
className="flex-1 flex-row items-center justify-center rounded-xl bg-white py-3.5 active:bg-neutral-50 dark:bg-neutral-800 dark:active:bg-neutral-700"
408+
>
409+
<Ionicons name="qr-code-outline" size={18} color="#3b82f6" />
410+
<Text className="ml-1.5 text-base font-medium text-blue-500">
411+
{t("common.share")}
412+
</Text>
413+
</Pressable>
413414

414-
{isEdit && (
415+
<Pressable
416+
onPress={() => setShowDeleteConfirm(true)}
417+
className="flex-1 flex-row items-center justify-center rounded-xl bg-red-500 py-3.5 active:bg-red-600"
418+
>
419+
<Ionicons name="trash-outline" size={18} color="#ffffff" />
420+
<Text className="ml-1.5 text-base font-semibold text-white">
421+
{t("common.delete")}
422+
</Text>
423+
</Pressable>
424+
</View>
425+
) : (
415426
<Pressable
416-
onPress={() => setShowDeleteConfirm(true)}
417-
className="mt-3 items-center rounded-xl py-3 active:bg-red-50 dark:active:bg-red-950"
427+
onPress={handleSave}
428+
className="items-center rounded-xl bg-blue-500 py-3.5 active:bg-blue-600"
418429
>
419-
<Text className="text-base font-medium text-red-500">
420-
{t("courseManage.deleteCourseTitle")}
430+
<Text className="text-base font-semibold text-white">
431+
{t("common.save")}
421432
</Text>
422433
</Pressable>
423434
)}

app/(pages)/settings/course/manage.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,11 @@ export default function ManageCourseScreen() {
166166

167167
{courses.length > 0 && (
168168
<Pressable
169-
className="mt-4 items-center rounded-xl bg-white py-3.5 active:bg-neutral-50 dark:bg-neutral-800 dark:active:bg-neutral-700"
169+
className="mt-4 flex-row items-center justify-center rounded-xl bg-red-500 py-3.5 active:bg-red-600"
170170
onPress={() => setClearVisible(true)}
171171
>
172-
<Text className="text-sm font-medium text-red-500">
172+
<Ionicons name="trash-outline" size={18} color="#ffffff" />
173+
<Text className="ml-1.5 text-sm font-semibold text-white">
173174
{t("courseManage.clearAll")}
174175
</Text>
175176
</Pressable>

app/(tabs)/course.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import { useColorScheme } from "@/hooks/use-color-scheme";
3333
import { useHaptics } from "@/hooks/use-haptics";
3434
import { useMarkRouteInteractive } from "@/hooks/use-mark-route-interactive";
3535
import { MAX_WEEK } from "@/lib/course-weeks";
36-
import { getCurrentDayOfWeek, getCurrentWeek } from "@/lib/date";
36+
import { getCurrentDayOfWeek, getCurrentWeek, isVacation } from "@/lib/date";
3737
import { useT } from "@/lib/i18n";
3838
import { type ImportType, useCourseStore } from "@/store/course";
3939
import { useScheduleStore } from "@/store/schedule";
@@ -245,7 +245,11 @@ export default function CourseScreen() {
245245
<Schedule
246246
courses={courses}
247247
week={week}
248-
today={week === getCurrentWeek(termStart) ? today : undefined}
248+
today={
249+
!isVacation(termStart) && week === getCurrentWeek(termStart)
250+
? today
251+
: undefined
252+
}
249253
termStart={termStart}
250254
onWeekChange={goToWeek}
251255
/>

0 commit comments

Comments
 (0)