Code only displayed for owner and is not lost on refresh
This commit is contained in:
@@ -28,7 +28,8 @@ public class GetWhiteboardService
|
|||||||
{
|
{
|
||||||
WhiteboardId = entity.Id,
|
WhiteboardId = entity.Id,
|
||||||
OwnerId = entity.OwnerId,
|
OwnerId = entity.OwnerId,
|
||||||
Owner = new User(entity.Owner.Id, entity.Owner.UserName!, entity.Owner.Email!)
|
Owner = new User(entity.Owner.Id, entity.Owner.UserName!, entity.Owner.Email!),
|
||||||
|
Code = entity.Code,
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach (var membership in entity.Memberships)
|
foreach (var membership in entity.Memberships)
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ public class Whiteboard
|
|||||||
public Guid OwnerId { get; set; }
|
public Guid OwnerId { get; set; }
|
||||||
public User Owner { get; set; } = null!;
|
public User Owner { get; set; } = null!;
|
||||||
|
|
||||||
|
public string Code {get; set;}
|
||||||
|
|
||||||
public List<User> Users { get; } = [];
|
public List<User> Users { get; } = [];
|
||||||
|
|
||||||
public List<User> ActiveUsers { get; } = [];
|
public List<User> ActiveUsers { get; } = [];
|
||||||
|
|||||||
@@ -23,6 +23,12 @@ const colors = ['#4f9dff', '#ff4f4f', '#4fff4f', '#ffff4f', '#ff4fff', '#ffffff'
|
|||||||
|
|
||||||
const isReadOnly = computed(() => sessionStore.selectedTool === 'hand' && !!sessionStore.selectedShape)
|
const isReadOnly = computed(() => sessionStore.selectedTool === 'hand' && !!sessionStore.selectedShape)
|
||||||
|
|
||||||
|
const isOwner = computed(() => {
|
||||||
|
const wb = sessionStore.whiteboard
|
||||||
|
if (!wb || !auth.user) return false
|
||||||
|
return wb.ownerId === auth.user.userId
|
||||||
|
})
|
||||||
|
|
||||||
const showProperties = computed(() => {
|
const showProperties = computed(() => {
|
||||||
if (['rectangle', 'arrow', 'line', 'text'].includes(sessionStore.selectedTool)) return true
|
if (['rectangle', 'arrow', 'line', 'text'].includes(sessionStore.selectedTool)) return true
|
||||||
if (sessionStore.selectedTool === 'hand' && sessionStore.selectedShape) return true
|
if (sessionStore.selectedTool === 'hand' && sessionStore.selectedShape) return true
|
||||||
@@ -61,7 +67,7 @@ const displayTextSize = computed(() => {
|
|||||||
|
|
||||||
const showCopiedTooltip = ref(false)
|
const showCopiedTooltip = ref(false)
|
||||||
|
|
||||||
const whiteboardCode = computed(() => infoStore.getCurrentWhiteboard()?.code || '')
|
const whiteboardCode = computed(() => sessionStore.whiteboard!.code)
|
||||||
|
|
||||||
const copyCodeToClipboard = async () => {
|
const copyCodeToClipboard = async () => {
|
||||||
console.info(whiteboardCode.value)
|
console.info(whiteboardCode.value)
|
||||||
@@ -166,7 +172,7 @@ const copyCodeToClipboard = async () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="position-relative mb-2">
|
<div v-if="isOwner" class="position-relative mb-2">
|
||||||
<button
|
<button
|
||||||
class="btn btn-sm btn-outline-primary w-100"
|
class="btn btn-sm btn-outline-primary w-100"
|
||||||
@click="copyCodeToClipboard"
|
@click="copyCodeToClipboard"
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ export interface TextShape extends Shape {
|
|||||||
export interface Whiteboard {
|
export interface Whiteboard {
|
||||||
whiteboardId: string
|
whiteboardId: string
|
||||||
ownerId: string
|
ownerId: string
|
||||||
|
code: string
|
||||||
rectangles: Rectangle[]
|
rectangles: Rectangle[]
|
||||||
arrows: Arrow[]
|
arrows: Arrow[]
|
||||||
lines: Line[]
|
lines: Line[]
|
||||||
|
|||||||
Reference in New Issue
Block a user