Skip to content

Commit f1e9fa5

Browse files
authored
Remove todo!() in pause/resume and fix timing on macos (#1153)
* fix pause/resume and timing on macos * clippy
1 parent fb8a6c1 commit f1e9fa5

File tree

11 files changed

+97
-139
lines changed

11 files changed

+97
-139
lines changed

apps/desktop/src-tauri/src/recording.rs

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -85,20 +85,18 @@ impl InProgressRecording {
8585
}
8686
}
8787

88-
pub async fn pause(&self) -> Result<(), RecordingError> {
89-
todo!()
90-
// match self {
91-
// Self::Instant { handle, .. } => handle.pause().await,
92-
// Self::Studio { handle, .. } => handle.pause().await,
93-
// }
88+
pub async fn pause(&self) -> anyhow::Result<()> {
89+
match self {
90+
Self::Instant { handle, .. } => handle.pause().await,
91+
Self::Studio { handle, .. } => handle.pause().await,
92+
}
9493
}
9594

96-
pub async fn resume(&self) -> Result<(), String> {
97-
todo!()
98-
// match self {
99-
// Self::Instant { handle, .. } => handle.resume().await.map_err(|e| e.to_string()),
100-
// Self::Studio { handle, .. } => handle.resume().await.map_err(|e| e.to_string()),
101-
// }
95+
pub async fn resume(&self) -> anyhow::Result<()> {
96+
match self {
97+
Self::Instant { handle, .. } => handle.resume().await,
98+
Self::Studio { handle, .. } => handle.resume().await,
99+
}
102100
}
103101

104102
pub fn recording_dir(&self) -> &PathBuf {
@@ -140,12 +138,11 @@ impl InProgressRecording {
140138
}
141139
}
142140

143-
pub async fn cancel(self) -> Result<(), RecordingError> {
144-
todo!()
145-
// match self {
146-
// Self::Instant { handle, .. } => handle.cancel().await,
147-
// Self::Studio { handle, .. } => handle.cancel().await,
148-
// }
141+
pub async fn cancel(self) -> anyhow::Result<()> {
142+
match self {
143+
Self::Instant { handle, .. } => handle.cancel().await,
144+
Self::Studio { handle, .. } => handle.cancel().await,
145+
}
149146
}
150147

151148
pub fn mode(&self) -> RecordingMode {
@@ -673,7 +670,7 @@ pub async fn restart_recording(app: AppHandle, state: MutableState<'_, App>) ->
673670

674671
let inputs = recording.inputs().clone();
675672

676-
// let _ = recording.cancel().await;
673+
let _ = recording.cancel().await;
677674

678675
tokio::time::sleep(Duration::from_millis(1000)).await;
679676

apps/web/app/(org)/dashboard/_components/Navbar/Items.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,9 @@ const NavItem = ({
492492
{name}
493493
</p>
494494
{extraText && !sidebarCollapsed && (
495-
<p className="ml-auto text-xs text-gray-11">{extraText}</p>
495+
<p className="ml-auto text-xs font-medium text-gray-11">
496+
{extraText}
497+
</p>
496498
)}
497499
</Link>
498500
</Tooltip>

apps/web/app/(org)/dashboard/caps/Caps.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,6 @@ export const Caps = ({
232232
data.error === 1 ? "" : "s"
233233
}`;
234234
}
235-
router.refresh();
236235
return `Successfully deleted ${data.success} cap${
237236
data.success === 1 ? "" : "s"
238237
}`;
@@ -267,7 +266,7 @@ export const Caps = ({
267266
[data, isUploading, uploadingCapId],
268267
);
269268

270-
if (count === 0 && folders.length === 0) return <EmptyCapState />;
269+
if (count === 0) return <EmptyCapState />;
271270

272271
return (
273272
<div className="flex relative flex-col w-full h-full">

apps/web/app/(org)/dashboard/caps/components/Folder.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -273,11 +273,9 @@ const FolderCard = ({
273273
<Link
274274
prefetch={false}
275275
href={
276-
deleteFolder.isPending
277-
? "#"
278-
: spaceId
279-
? `/dashboard/spaces/${spaceId}/folder/${id}`
280-
: `/dashboard/folder/${id}`
276+
spaceId
277+
? `/dashboard/spaces/${spaceId}/folder/${id}`
278+
: `/dashboard/folder/${id}`
281279
}
282280
>
283281
<div

apps/web/app/s/[videoId]/_components/ShareHeader.tsx

Lines changed: 15 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@
33
import type { userSelectProps } from "@cap/database/auth/session";
44
import type { videos } from "@cap/database/schema";
55
import { buildEnv, NODE_ENV } from "@cap/env";
6-
import { Avatar, Button } from "@cap/ui";
6+
import { Button } from "@cap/ui";
77
import { userIsPro } from "@cap/utils";
88
import { faChevronDown, faLock } from "@fortawesome/free-solid-svg-icons";
99
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
1010
import clsx from "clsx";
1111
import { Check, Copy, Globe2 } from "lucide-react";
1212
import moment from "moment";
13-
import Image from "next/image";
1413
import { useRouter } from "next/navigation";
1514
import { useEffect, useState } from "react";
1615
import { toast } from "sonner";
@@ -30,10 +29,7 @@ export const ShareHeader = ({
3029
sharedSpaces = [],
3130
spacesData = null,
3231
}: {
33-
data: typeof videos.$inferSelect & {
34-
organizationIconUrl?: string | null;
35-
organizationName?: string | null;
36-
};
32+
data: typeof videos.$inferSelect;
3733
user: typeof userSelectProps | null;
3834
customDomain?: string | null;
3935
domainVerified?: boolean;
@@ -74,11 +70,9 @@ export const ShareHeader = ({
7470

7571
const handleBlur = async () => {
7672
setIsEditing(false);
77-
const next = title.trim();
78-
if (next === "" || next === data.name) return;
73+
7974
try {
80-
await editTitle(data.id, next);
81-
setTitle(next);
75+
await editTitle(data.id, title);
8276
toast.success("Video title updated");
8377
refresh();
8478
} catch (error) {
@@ -87,7 +81,6 @@ export const ShareHeader = ({
8781
} else {
8882
toast.error("Failed to update title - please try again.");
8983
}
90-
setTitle(data.name);
9184
}
9285
};
9386

@@ -143,7 +136,7 @@ export const ShareHeader = ({
143136

144137
const renderSharedStatus = () => {
145138
const baseClassName =
146-
"text-sm text-gray-10 justify-center lg:justify-start transition-colors duration-200 flex items-center";
139+
"text-sm text-gray-10 transition-colors duration-200 flex items-center";
147140

148141
if (isOwner) {
149142
const hasSpaceSharing =
@@ -205,37 +198,17 @@ export const ShareHeader = ({
205198
/>
206199
<div className="mt-8">
207200
<div className="flex flex-col gap-6 lg:flex-row lg:items-center lg:justify-between lg:gap-0">
208-
<div className="justify-center items-center mb-3 w-full md:flex lg:justify-between md:space-x-6 md:mb-0">
209-
<div className="flex flex-col gap-5 md:gap-10 lg:flex-row">
210-
<div className="flex flex-col flex-1 justify-center items-center w-full lg:justify-evenly">
211-
{data.organizationIconUrl ? (
212-
<Image
213-
className="rounded-full size-9"
214-
src={data.organizationIconUrl}
215-
alt="Organization icon"
216-
width={36}
217-
height={36}
218-
/>
219-
) : (
220-
<Avatar
221-
className="rounded-full size-9"
222-
name={data.organizationName ?? "Organization"}
223-
letterClass="text-sm"
224-
/>
225-
)}
226-
<p className="text-sm font-medium text-gray-12">
227-
{data.organizationName}
228-
</p>
229-
</div>
230-
<div className="flex flex-col justify-center text-center lg:text-left lg:justify-start">
201+
<div className="items-center md:flex md:justify-between md:space-x-6">
202+
<div className="mb-3 md:mb-0">
203+
<div className="flex items-center space-x-3 lg:min-w-[400px]">
231204
{isEditing ? (
232205
<input
233206
value={title}
234207
onChange={(e) => setTitle(e.target.value)}
235208
onBlur={handleBlur}
236209
onKeyDown={handleKeyDown}
237210
autoFocus
238-
className="w-full text-xl sm:text-2xl"
211+
className="w-full text-xl font-semibold sm:text-2xl"
239212
/>
240213
) : (
241214
<h1
@@ -249,16 +222,16 @@ export const ShareHeader = ({
249222
{title}
250223
</h1>
251224
)}
252-
{user && renderSharedStatus()}
253-
<p className="mt-1 text-sm text-gray-10">
254-
{moment(data.createdAt).fromNow()}
255-
</p>
256225
</div>
226+
{user && renderSharedStatus()}
227+
<p className="mt-1 text-sm text-gray-10">
228+
{moment(data.createdAt).fromNow()}
229+
</p>
257230
</div>
258231
</div>
259232
{user !== null && (
260-
<div className="flex justify-center space-x-2 w-full lg:justify-end">
261-
<div className="w-fit">
233+
<div className="flex space-x-2">
234+
<div>
262235
<div className="flex gap-2 items-center">
263236
{data.password && (
264237
<FontAwesomeIcon

apps/web/app/s/[videoId]/page.tsx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,6 @@ type VideoWithOrganization = typeof videos.$inferSelect & {
111111
hasPassword?: boolean;
112112
ownerIsPro?: boolean;
113113
orgSettings?: OrganizationSettings | null;
114-
organizationIconUrl?: string | null;
115-
organizationName?: string | null;
116114
};
117115

118116
const ALLOWED_REFERRERS = [
@@ -295,8 +293,6 @@ export default async function ShareVideoPage(props: PageProps<"/s/[videoId]">) {
295293
duration: videos.duration,
296294
fps: videos.fps,
297295
hasPassword: sql`${videos.password} IS NOT NULL`.mapWith(Boolean),
298-
organizationIconUrl: organizations.iconUrl,
299-
organizationName: organizations.name,
300296
sharedOrganization: {
301297
organizationId: sharedVideos.organizationId,
302298
},
@@ -369,8 +365,6 @@ async function AuthorizedContent({
369365
ownerIsPro?: boolean;
370366
orgSettings?: OrganizationSettings | null;
371367
videoSettings?: OrganizationSettings | null;
372-
organizationIconUrl?: string | null;
373-
organizationName?: string | null;
374368
};
375369
searchParams: { [key: string]: string | string[] | undefined };
376370
}) {
@@ -493,8 +487,6 @@ async function AuthorizedContent({
493487
sharedOrganization: {
494488
organizationId: sharedVideos.organizationId,
495489
},
496-
organizationIconUrl: organizations.iconUrl,
497-
organizationName: organizations.name,
498490
orgSettings: organizations.settings,
499491
videoSettings: videos.settings,
500492
})
@@ -696,8 +688,6 @@ async function AuthorizedContent({
696688
folderId: null,
697689
orgSettings: video.orgSettings || null,
698690
settings: video.videoSettings || null,
699-
organizationIconUrl: video.organizationIconUrl ?? undefined,
700-
organizationName: video.organizationName ?? undefined,
701691
};
702692

703693
return (

apps/web/components/forms/NewOrganization.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export interface NewOrganizationProps {
2525

2626
export const NewOrganization: React.FC<NewOrganizationProps> = (props) => {
2727
const formSchema = z.object({
28-
name: z.string().min(1).max(25),
28+
name: z.string().min(1),
2929
});
3030

3131
const form = useForm<z.infer<typeof formSchema>>({
@@ -77,7 +77,6 @@ export const NewOrganization: React.FC<NewOrganizationProps> = (props) => {
7777
render={({ field }) => (
7878
<FormControl>
7979
<Input
80-
maxLength={25}
8180
placeholder="Your organization name"
8281
{...field}
8382
onChange={(e) => {

0 commit comments

Comments
 (0)