Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions apps/web/app/(org)/dashboard/_components/Navbar/Items.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -492,9 +492,7 @@ const NavItem = ({
{name}
</p>
{extraText && !sidebarCollapsed && (
<p className="ml-auto text-xs font-medium text-gray-11">
{extraText}
</p>
<p className="ml-auto text-xs text-gray-11">{extraText}</p>
)}
</Link>
</Tooltip>
Expand Down
56 changes: 42 additions & 14 deletions apps/web/app/s/[videoId]/_components/ShareHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
import type { userSelectProps } from "@cap/database/auth/session";
import type { videos } from "@cap/database/schema";
import { buildEnv, NODE_ENV } from "@cap/env";
import { Button } from "@cap/ui";
import { Avatar, Button } from "@cap/ui";
import { userIsPro } from "@cap/utils";
import { faChevronDown, faLock } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import clsx from "clsx";
import { Check, Copy, Globe2 } from "lucide-react";
import moment from "moment";
import Image from "next/image";
import { useRouter } from "next/navigation";
import { useEffect, useState } from "react";
import { toast } from "sonner";
Expand All @@ -29,7 +30,10 @@ export const ShareHeader = ({
sharedSpaces = [],
spacesData = null,
}: {
data: typeof videos.$inferSelect;
data: typeof videos.$inferSelect & {
organizationIconUrl?: string | null;
organizationName?: string | null;
};
user: typeof userSelectProps | null;
customDomain?: string | null;
domainVerified?: boolean;
Expand Down Expand Up @@ -62,6 +66,8 @@ export const ShareHeader = ({

const isOwner = user && user.id.toString() === data.ownerId;

console.log(data);
Comment thread
ameer2468 marked this conversation as resolved.
Outdated

const { webUrl } = usePublicEnv();

useEffect(() => {
Expand All @@ -70,7 +76,9 @@ export const ShareHeader = ({

const handleBlur = async () => {
setIsEditing(false);

if (title === data.name) {
return;
}
try {
Comment thread
ameer2468 marked this conversation as resolved.
await editTitle(data.id, title);
toast.success("Video title updated");
Expand Down Expand Up @@ -136,7 +144,7 @@ export const ShareHeader = ({

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

if (isOwner) {
const hasSpaceSharing =
Expand Down Expand Up @@ -198,17 +206,37 @@ export const ShareHeader = ({
/>
<div className="mt-8">
<div className="flex flex-col gap-6 lg:flex-row lg:items-center lg:justify-between lg:gap-0">
<div className="items-center md:flex md:justify-between md:space-x-6">
<div className="mb-3 md:mb-0">
<div className="flex items-center space-x-3 lg:min-w-[400px]">
<div className="justify-center items-center mb-3 w-full md:flex lg:justify-between md:space-x-6 md:mb-0">
<div className="flex flex-col gap-5 md:gap-10 lg:flex-row">
<div className="flex flex-col flex-1 justify-center items-center w-full lg:justify-evenly">
{data.organizationIconUrl ? (
<Image
className="rounded-full size-9"
src={data.organizationIconUrl}
alt="Organization icon"
width={36}
height={36}
/>
) : (
<Avatar
className="rounded-full size-9"
name={data.organizationName}
letterClass="text-sm"
/>
)}
<p className="text-sm font-medium text-gray-12">
{data.organizationName}
</p>
</div>
Comment thread
ameer2468 marked this conversation as resolved.
<div className="flex flex-col justify-center text-center lg:text-left lg:justify-start">
{isEditing ? (
<input
value={title}
onChange={(e) => setTitle(e.target.value)}
onBlur={handleBlur}
onKeyDown={handleKeyDown}
autoFocus
className="w-full text-xl font-semibold sm:text-2xl"
className="w-full text-xl sm:text-2xl"
/>
) : (
<h1
Expand All @@ -222,16 +250,16 @@ export const ShareHeader = ({
{title}
</h1>
)}
{user && renderSharedStatus()}
<p className="mt-1 text-sm text-gray-10">
{moment(data.createdAt).fromNow()}
</p>
</div>
{user && renderSharedStatus()}
<p className="mt-1 text-sm text-gray-10">
{moment(data.createdAt).fromNow()}
</p>
</div>
</div>
{user !== null && (
<div className="flex space-x-2">
<div>
<div className="flex justify-center space-x-2 w-full lg:justify-end">
<div className="w-fit">
<div className="flex gap-2 items-center">
{data.password && (
<FontAwesomeIcon
Expand Down
8 changes: 8 additions & 0 deletions apps/web/app/s/[videoId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ type VideoWithOrganization = typeof videos.$inferSelect & {
hasPassword?: boolean;
ownerIsPro?: boolean;
orgSettings?: OrganizationSettings | null;
organizationIconUrl?: string | null;
organizationName?: string | null;
};

const ALLOWED_REFERRERS = [
Expand Down Expand Up @@ -359,6 +361,8 @@ async function AuthorizedContent({
ownerIsPro?: boolean;
orgSettings?: OrganizationSettings | null;
videoSettings?: OrganizationSettings | null;
organizationIconUrl?: string | null;
organizationName?: string | null;
};
searchParams: { [key: string]: string | string[] | undefined };
}) {
Expand Down Expand Up @@ -477,6 +481,8 @@ async function AuthorizedContent({
sharedOrganization: {
organizationId: sharedVideos.organizationId,
},
organizationIconUrl: organizations.iconUrl,
organizationName: organizations.name,
orgSettings: organizations.settings,
videoSettings: videos.settings,
})
Expand Down Expand Up @@ -678,6 +684,8 @@ async function AuthorizedContent({
folderId: null,
orgSettings: video.orgSettings || null,
settings: video.videoSettings || null,
organizationIconUrl: video.organizationIconUrl ?? undefined,
organizationName: video.organizationName ?? undefined,
Comment thread
ameer2468 marked this conversation as resolved.
Comment thread
coderabbitai[bot] marked this conversation as resolved.
};

return (
Expand Down
3 changes: 2 additions & 1 deletion apps/web/components/forms/NewOrganization.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export interface NewOrganizationProps {

export const NewOrganization: React.FC<NewOrganizationProps> = (props) => {
const formSchema = z.object({
name: z.string().min(1),
name: z.string().min(1).max(25),
});

const form = useForm<z.infer<typeof formSchema>>({
Expand Down Expand Up @@ -77,6 +77,7 @@ export const NewOrganization: React.FC<NewOrganizationProps> = (props) => {
render={({ field }) => (
<FormControl>
<Input
maxLength={25}
placeholder="Your organization name"
{...field}
onChange={(e) => {
Expand Down
Loading