A personal media tracker built on the AT Protocol opnshelf.xyz
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: change 'Select Watch Date' to 'Watch Again' when already watched

+21 -14
+19 -12
apps/mobile/app/movie/[id].tsx
··· 5 5 TmdbMovieDetailDto, 6 6 } from "@opnshelf/api"; 7 7 import { 8 + authControllerMeOptions, 8 9 listsControllerGetListsForItemOptions, 9 10 type MovieListsForItemDto, 10 11 moviesControllerDeleteWatchHistoryEntryMutation, ··· 87 88 const { showToast } = useToast(); 88 89 const queryClient = useQueryClient(); 89 90 91 + const { data: user } = useQuery({ 92 + ...authControllerMeOptions(), 93 + staleTime: 5 * 60 * 1000, 94 + retry: false, 95 + }); 96 + 90 97 const [showDateModal, setShowDateModal] = useState(false); 91 98 const [showAddToListModal, setShowAddToListModal] = useState(false); 92 99 const [customDate, setCustomDate] = useState<Date>(new Date()); ··· 111 118 112 119 const { data: trackedMovies } = useQuery({ 113 120 ...moviesControllerGetUserMoviesOptions({ 114 - path: { userDid: "" }, 121 + path: { userDid: user?.did || "" }, 115 122 }), 116 - enabled: false, 123 + enabled: !!user?.did, 117 124 }); 118 125 119 126 const { data: watchHistory } = useQuery({ 120 127 ...moviesControllerGetMovieWatchHistoryOptions({ 121 - path: { userDid: "", movieId }, 128 + path: { userDid: user?.did || "", movieId }, 122 129 }), 123 - enabled: false, 130 + enabled: !!user?.did, 124 131 }); 125 132 126 133 const { data: userSettings } = useQuery({ 127 134 ...usersControllerGetMySettingsOptions(), 128 - enabled: false, 135 + enabled: !!user?.did, 129 136 }); 130 137 131 138 const { data: listsForMovie } = useQuery({ 132 139 ...listsControllerGetListsForItemOptions({ 133 140 path: { mediaType: "movie", mediaId: movieId }, 134 141 }), 135 - enabled: false, 142 + enabled: !!user?.did, 136 143 }); 137 144 138 145 const listsForMovieTyped = (listsForMovie || []) as MovieListsForItemDto[]; ··· 162 169 onSuccess: () => { 163 170 queryClient.invalidateQueries({ 164 171 queryKey: moviesControllerGetUserMoviesQueryKey({ 165 - path: { userDid: "" }, 172 + path: { userDid: user?.did || "" }, 166 173 }), 167 174 }); 168 175 queryClient.invalidateQueries({ 169 176 queryKey: moviesControllerGetMovieWatchHistoryQueryKey({ 170 - path: { userDid: "", movieId }, 177 + path: { userDid: user?.did || "", movieId }, 171 178 }), 172 179 }); 173 180 setShowDateModal(false); ··· 184 191 onSuccess: () => { 185 192 queryClient.invalidateQueries({ 186 193 queryKey: moviesControllerGetUserMoviesQueryKey({ 187 - path: { userDid: "" }, 194 + path: { userDid: user?.did || "" }, 188 195 }), 189 196 }); 190 197 queryClient.invalidateQueries({ 191 198 queryKey: moviesControllerGetMovieWatchHistoryQueryKey({ 192 - path: { userDid: "", movieId }, 199 + path: { userDid: user?.did || "", movieId }, 193 200 }), 194 201 }); 195 202 showToast("Removed from your shelf", "success"); ··· 205 212 onSuccess: () => { 206 213 queryClient.invalidateQueries({ 207 214 queryKey: moviesControllerGetUserMoviesQueryKey({ 208 - path: { userDid: "" }, 215 + path: { userDid: user?.did || "" }, 209 216 }), 210 217 }); 211 218 queryClient.invalidateQueries({ 212 219 queryKey: moviesControllerGetMovieWatchHistoryQueryKey({ 213 - path: { userDid: "", movieId }, 220 + path: { userDid: user?.did || "", movieId }, 214 221 }), 215 222 }); 216 223 showToast("Watch entry removed", "success");
+1 -1
apps/mobile/components/detail/DetailActions.tsx
··· 121 121 ) : ( 122 122 <View style={styles.buttonContent}> 123 123 <Ionicons name="refresh" size={18} color="#f9fafb" /> 124 - <Text style={styles.primaryButtonText}>Select Watch Date</Text> 124 + <Text style={styles.primaryButtonText}>Watch Again</Text> 125 125 </View> 126 126 )} 127 127 </LinearGradient>
+1 -1
apps/web/src/components/detail/DetailActions.tsx
··· 109 109 <AddToShelfButton 110 110 onClick={onMarkWatched} 111 111 isPending={isMarkingPending} 112 - label="Select Watch Date" 112 + label="Watch Again" 113 113 icon={<RotateCcw className="w-4 h-4" />} 114 114 colors={colors} 115 115 size="compact"