feat: enhance session management by implementing edit permissions for team admins and updating session components to reflect new access controls
This commit is contained in:
@@ -6,19 +6,19 @@ import { updateMotivatorSession } from '@/actions/moving-motivators';
|
||||
interface EditableMotivatorTitleProps {
|
||||
sessionId: string;
|
||||
initialTitle: string;
|
||||
isOwner: boolean;
|
||||
canEdit: boolean;
|
||||
}
|
||||
|
||||
export function EditableMotivatorTitle({
|
||||
sessionId,
|
||||
initialTitle,
|
||||
isOwner,
|
||||
canEdit,
|
||||
}: EditableMotivatorTitleProps) {
|
||||
return (
|
||||
<EditableTitle
|
||||
sessionId={sessionId}
|
||||
initialTitle={initialTitle}
|
||||
isOwner={isOwner}
|
||||
canEdit={canEdit}
|
||||
onUpdate={async (id, title) => {
|
||||
const result = await updateMotivatorSession(id, { title });
|
||||
return result;
|
||||
|
||||
@@ -6,19 +6,19 @@ import { updateSessionTitle } from '@/actions/session';
|
||||
interface EditableSessionTitleProps {
|
||||
sessionId: string;
|
||||
initialTitle: string;
|
||||
isOwner: boolean;
|
||||
canEdit: boolean;
|
||||
}
|
||||
|
||||
export function EditableSessionTitle({
|
||||
sessionId,
|
||||
initialTitle,
|
||||
isOwner,
|
||||
canEdit,
|
||||
}: EditableSessionTitleProps) {
|
||||
return (
|
||||
<EditableTitle
|
||||
sessionId={sessionId}
|
||||
initialTitle={initialTitle}
|
||||
isOwner={isOwner}
|
||||
canEdit={canEdit}
|
||||
onUpdate={async (id, title) => {
|
||||
const result = await updateSessionTitle(id, title);
|
||||
return result;
|
||||
|
||||
@@ -5,14 +5,14 @@ import { useState, useTransition, useRef, useEffect, useMemo } from 'react';
|
||||
interface EditableTitleProps {
|
||||
sessionId: string;
|
||||
initialTitle: string;
|
||||
isOwner: boolean;
|
||||
canEdit: boolean;
|
||||
onUpdate: (sessionId: string, title: string) => Promise<{ success: boolean; error?: string }>;
|
||||
}
|
||||
|
||||
export function EditableTitle({
|
||||
sessionId,
|
||||
initialTitle,
|
||||
isOwner,
|
||||
canEdit,
|
||||
onUpdate,
|
||||
}: EditableTitleProps) {
|
||||
const [isEditing, setIsEditing] = useState(false);
|
||||
@@ -65,7 +65,7 @@ export function EditableTitle({
|
||||
}
|
||||
};
|
||||
|
||||
if (!isOwner) {
|
||||
if (!canEdit) {
|
||||
return <h1 className="text-3xl font-bold text-foreground">{title}</h1>;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,19 +6,19 @@ import { updateWeatherSession } from '@/actions/weather';
|
||||
interface EditableWeatherTitleProps {
|
||||
sessionId: string;
|
||||
initialTitle: string;
|
||||
isOwner: boolean;
|
||||
canEdit: boolean;
|
||||
}
|
||||
|
||||
export function EditableWeatherTitle({
|
||||
sessionId,
|
||||
initialTitle,
|
||||
isOwner,
|
||||
canEdit,
|
||||
}: EditableWeatherTitleProps) {
|
||||
return (
|
||||
<EditableTitle
|
||||
sessionId={sessionId}
|
||||
initialTitle={initialTitle}
|
||||
isOwner={isOwner}
|
||||
canEdit={canEdit}
|
||||
onUpdate={async (id, title) => {
|
||||
const result = await updateWeatherSession(id, { title });
|
||||
return result;
|
||||
|
||||
@@ -6,19 +6,19 @@ import { updateWeeklyCheckInSession } from '@/actions/weekly-checkin';
|
||||
interface EditableWeeklyCheckInTitleProps {
|
||||
sessionId: string;
|
||||
initialTitle: string;
|
||||
isOwner: boolean;
|
||||
canEdit: boolean;
|
||||
}
|
||||
|
||||
export function EditableWeeklyCheckInTitle({
|
||||
sessionId,
|
||||
initialTitle,
|
||||
isOwner,
|
||||
canEdit,
|
||||
}: EditableWeeklyCheckInTitleProps) {
|
||||
return (
|
||||
<EditableTitle
|
||||
sessionId={sessionId}
|
||||
initialTitle={initialTitle}
|
||||
isOwner={isOwner}
|
||||
canEdit={canEdit}
|
||||
onUpdate={async (id, title) => {
|
||||
const result = await updateWeeklyCheckInSession(id, { title });
|
||||
return result;
|
||||
|
||||
@@ -6,19 +6,19 @@ import { updateYearReviewSession } from '@/actions/year-review';
|
||||
interface EditableYearReviewTitleProps {
|
||||
sessionId: string;
|
||||
initialTitle: string;
|
||||
isOwner: boolean;
|
||||
canEdit: boolean;
|
||||
}
|
||||
|
||||
export function EditableYearReviewTitle({
|
||||
sessionId,
|
||||
initialTitle,
|
||||
isOwner,
|
||||
canEdit,
|
||||
}: EditableYearReviewTitleProps) {
|
||||
return (
|
||||
<EditableTitle
|
||||
sessionId={sessionId}
|
||||
initialTitle={initialTitle}
|
||||
isOwner={isOwner}
|
||||
canEdit={canEdit}
|
||||
onUpdate={async (id, title) => {
|
||||
const result = await updateYearReviewSession(id, { title });
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user