Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
feat: Add empty state to comments
Richie McIlroye16e980aa596
diff --git a/apps/web/app/s/[videoId]/_components/tabs/Activity.tsx b/apps/web/app/s/[videoId]/_components/tabs/Activity.tsxindex e2e88c0ff..ea2dbccaf 100644--- a/apps/web/app/s/[videoId]/_components/tabs/Activity.tsx+++ b/apps/web/app/s/[videoId]/_components/tabs/Activity.tsx@@ -291,6 +291,35 @@ const Comment: React.FC<{);};+const EmptyState = () => (+ <motion.div+ initial={{ opacity: 0 }}+ animate={{ opacity: 1 }}+ className="flex flex-col items-center justify-center h-full p-8 text-center"+ >+ <div className="text-gray-300 mb-2">+ <svg+ xmlns="http://www.w3.org/2000/svg"+ className="h-12 w-12 mx-auto mb-4"+ fill="none"+ viewBox="0 0 24 24"+ stroke="currentColor"+ >+ <path+ strokeLinecap="round"+ strokeLinejoin="round"+ strokeWidth={1.5}+ d="M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"+ />+ </svg>+ <h3 className="text-lg font-medium text-gray-500 mb-1">+ No comments yet+ </h3>+ <p className="text-gray-400">Be the first to share your thoughts!</p>+ </div>+ </motion.div>+);+export const Activity: React.FC<ActivityProps> = ({analytics: initialAnalytics,comments: initialComments,@@ -538,36 +567,40 @@ export const Activity: React.FC<ActivityProps> = ({ref={commentsContainerRef}className="flex-1 overflow-y-auto min-h-0">- <div className="space-y-6 p-4">- <AnimatePresence mode="sync">- {rootComments- .sort(- (a, b) =>- new Date(a.createdAt).getTime() -- new Date(b.createdAt).getTime()- )- .map((comment) => (- <Comment- key={comment.id}- comment={comment}- replies={allComments}- onReply={(id) => {- if (!user) {- setShowAuthOverlay(true);- } else {- setReplyingTo(id);- }- }}- replyingToId={replyingTo}- handleReply={handleReply}- onCancelReply={handleCancelReply}- onDelete={handleDeleteComment}- user={user}- onSeek={onSeek}- />- ))}- </AnimatePresence>- </div>+ {rootComments.length === 0 && optimisticComments.length === 0 ? (+ <EmptyState />+ ) : (+ <div className="space-y-6 p-4">+ <AnimatePresence mode="sync">+ {rootComments+ .sort(+ (a, b) =>+ new Date(a.createdAt).getTime() -+ new Date(b.createdAt).getTime()+ )+ .map((comment) => (+ <Comment+ key={comment.id}+ comment={comment}+ replies={allComments}+ onReply={(id) => {+ if (!user) {+ setShowAuthOverlay(true);+ } else {+ setReplyingTo(id);+ }+ }}+ replyingToId={replyingTo}+ handleReply={handleReply}+ onCancelReply={handleCancelReply}+ onDelete={handleDeleteComment}+ user={user}+ onSeek={onSeek}+ />+ ))}+ </AnimatePresence>+ </div>+ )}</div><div className="flex-none border-t border-gray-200 bg-white p-4">