Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
1 change: 0 additions & 1 deletion src/PersonalWebSpace_backend/main.mo
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import HTTP "./Http";

import Stoic "./EXT/Stoic";

import Protocol "./Protocol";
import Testable "mo:matchers/Testable";
import Blob "mo:base/Blob";
import Hash "mo:base/Hash";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<body>


<a-scene cursor="rayOrigin: mouse" gltf-model="dracoDecoderPath: https://www.gstatic.com/draco/v1/decoders/;" inspector="" keyboard-shortcuts="" screenshot="" vr-mode-ui="" device-orientation-permission-ui="" raycaster="direction: 0.9544506796854287 -0.10164039183312146 -0.2805229594810959; origin: -4.846717797159805 5.074580504821491 2.3289351396596443; useWorldCoordinates: true">
<a-scene cursor="rayOrigin: mouse" gltf-model="dracoDecoderPath: https://www.gstatic.com/draco/v1/decoders/;" inspector="" keyboard-shortcuts="" screenshot="width: 1920; height: 1080;" vr-mode-ui="" device-orientation-permission-ui="" raycaster="direction: 0.9544506796854287 -0.10164039183312146 -0.2805229594810959; origin: -4.846717797159805 5.074580504821491 2.3289351396596443; useWorldCoordinates: true">
<a-assets>
<img crossorigin="anonymous" id="groundTexture" src="https://cdn.aframe.io/a-painter/images/floor.jpg">
<img crossorigin="anonymous" id="skyTexture" src="https://cdn.aframe.io/a-painter/images/sky.jpg">
Expand Down
2 changes: 1 addition & 1 deletion src/PersonalWebSpace_frontend/assets/defaultRoom.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<body>


<a-scene cursor="rayOrigin: mouse" gltf-model="dracoDecoderPath: https://www.gstatic.com/draco/v1/decoders/;" inspector="" keyboard-shortcuts="" screenshot="" vr-mode-ui="" device-orientation-permission-ui="" raycaster="direction: 0.9544506796854287 -0.10164039183312146 -0.2805229594810959; origin: -4.846717797159805 5.074580504821491 2.3289351396596443; useWorldCoordinates: true">
<a-scene cursor="rayOrigin: mouse" gltf-model="dracoDecoderPath: https://www.gstatic.com/draco/v1/decoders/;" inspector="" keyboard-shortcuts="" screenshot="width: 1920; height: 1080;" vr-mode-ui="" device-orientation-permission-ui="" raycaster="direction: 0.9544506796854287 -0.10164039183312146 -0.2805229594810959; origin: -4.846717797159805 5.074580504821491 2.3289351396596443; useWorldCoordinates: true">
<a-assets>
<img crossorigin="anonymous" id="groundTexture" src="https://cdn.aframe.io/a-painter/images/floor.jpg">
<img crossorigin="anonymous" id="skyTexture" src="https://cdn.aframe.io/a-painter/images/sky.jpg">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</head>
<body>

<a-scene cursor="rayOrigin: mouse" gltf-model="dracoDecoderPath: https://www.gstatic.com/draco/v1/decoders/;" inspector="" keyboard-shortcuts="" screenshot="" vr-mode-ui="" device-orientation-permission-ui="" raycaster="direction: 0.9544506796854287 -0.10164039183312146 -0.2805229594810959; origin: -4.846717797159805 5.074580504821491 2.3289351396596443; useWorldCoordinates: true">
<a-scene cursor="rayOrigin: mouse" gltf-model="dracoDecoderPath: https://www.gstatic.com/draco/v1/decoders/;" inspector="" keyboard-shortcuts="" screenshot="width: 1920; height: 1080;" vr-mode-ui="" device-orientation-permission-ui="" raycaster="direction: 0.9544506796854287 -0.10164039183312146 -0.2805229594810959; origin: -4.846717797159805 5.074580504821491 2.3289351396596443; useWorldCoordinates: true">
<a-assets>
<a-asset-item id="island-glb" src="tropical_island_modified.glb"></a-asset-item> <!-- Credits: "Tropical Island" (https://skfb.ly/6THzW) by Elin is licensed under Creative Commons Attribution (http://creativecommons.org/licenses/by/4.0/). -->
<a-asset-item id="sunbed-glb" src="at_a_beach_modified.glb"></a-asset-item> <!-- Credits:"At a beach" (https://skfb.ly/6SUss) by barcin is licensed under Creative Commons Attribution (http://creativecommons.org/licenses/by/4.0/). -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</head>
<body>

<a-scene cursor="rayOrigin: mouse" gltf-model="dracoDecoderPath: https://www.gstatic.com/draco/v1/decoders/;" inspector="" keyboard-shortcuts="" screenshot="" vr-mode-ui="" device-orientation-permission-ui="" raycaster="direction: 0.9544506796854287 -0.10164039183312146 -0.2805229594810959; origin: -4.846717797159805 5.074580504821491 2.3289351396596443; useWorldCoordinates: true">
<a-scene cursor="rayOrigin: mouse" gltf-model="dracoDecoderPath: https://www.gstatic.com/draco/v1/decoders/;" inspector="" keyboard-shortcuts="" screenshot="width: 1920; height: 1080;" vr-mode-ui="" device-orientation-permission-ui="" raycaster="direction: 0.9544506796854287 -0.10164039183312146 -0.2805229594810959; origin: -4.846717797159805 5.074580504821491 2.3289351396596443; useWorldCoordinates: true">
<a-assets>
<a-asset-item id="ground-glb" src="ground.glb"></a-asset-item>
<a-asset-item id="single_bed-glb" src="single_bed.glb"></a-asset-item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</head>
<body>

<a-scene cursor="rayOrigin: mouse" gltf-model="dracoDecoderPath: https://www.gstatic.com/draco/v1/decoders/;" inspector="" keyboard-shortcuts="" screenshot="" vr-mode-ui="" device-orientation-permission-ui="" raycaster="direction: 0.9544506796854287 -0.10164039183312146 -0.2805229594810959; origin: -4.846717797159805 5.074580504821491 2.3289351396596443; useWorldCoordinates: true" >
<a-scene cursor="rayOrigin: mouse" gltf-model="dracoDecoderPath: https://www.gstatic.com/draco/v1/decoders/;" inspector="" keyboard-shortcuts="" screenshot="width: 1920; height: 1080;" vr-mode-ui="" device-orientation-permission-ui="" raycaster="direction: 0.9544506796854287 -0.10164039183312146 -0.2805229594810959; origin: -4.846717797159805 5.074580504821491 2.3289351396596443; useWorldCoordinates: true" >
<a-assets>
<a-asset-item id="ground-glb" src="ground.glb"></a-asset-item>
<a-asset-item id="spaceshuttle-glb" src="discovery_space_shuttle.glb"></a-asset-item> <!-- Credits: "Discovery Space Shuttle" (https://skfb.ly/6R6Iu) by rsatenza is licensed under Creative Commons Attribution (http://creativecommons.org/licenses/by/4.0/). -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
: getStringForSpaceFromUserUploadedModel();
</script>
<div class="glb-model-space-preview space-y-1">
<iframe srcdoc={glbModelPreviewString} title="Preview of the Glb Model" width="100%" height="auto" class="py-2"></iframe>
<iframe id={modelUrl} srcdoc={glbModelPreviewString} title="Preview of the Glb Model" width="100%" height="auto" class="py-2"></iframe>
</div>

<style>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

</script>
<div class="media-content-space-preview space-y-1">
<iframe srcdoc={mediaContentPreviewString} title="Preview of the File's Content" width="100%" height="auto" class="py-2"></iframe>
<iframe id={contentUrl} srcdoc={mediaContentPreviewString} title="Preview of the File's Content" width="100%" height="auto" class="py-2"></iframe>
</div>

<style>
Expand Down
33 changes: 26 additions & 7 deletions src/PersonalWebSpace_frontend/components/ProtocolEntity.svelte
Original file line number Diff line number Diff line change
@@ -1,13 +1,32 @@
<script lang="ts">
import type { Entity } from "src/integrations/BebbProtocol/bebb.did";
import type { BebbEntity } from "../helpers/bebb_utils";

export let entity : Entity;
export let entity : BebbEntity;
export let viewerIsSpaceOwner: Boolean = false;
export let deleteSpaceNeighborFunction; // Function passed to delete the link between the Space and the Neighbor

// Helper functions to check whether the Entity has got a valid URL that can be displayed
let extractedEntityUrl;
const extractUrlFromEntity = (entity) => {
try {
// Parse the entitySpecificFields as JSON
const fields = JSON.parse(entity.entitySpecificFields);
// Extract the externalId which contains the URL
const url = fields.externalId;
return url;
} catch (error) {
console.error("Error extracting URL: ", error);
return null; // or handle the error as needed
}
};

const entityHasValidUrl = () => {
return isValidUrl(entity.entitySpecificFields);
extractedEntityUrl = extractUrlFromEntity(entity);
if (extractedEntityUrl) {
return isValidUrl(extractedEntityUrl);
} else {
return false;
};
};

const isValidUrl = (url) => {
Expand Down Expand Up @@ -46,10 +65,10 @@

{#if entityHasValidUrl()}
<div class="space-neighbor-preview space-y-1">
<a target="_blank" rel="noreferrer" href={entity.entitySpecificFields} >
<iframe src={entity.entitySpecificFields} title="Entity Preview" width="100%" height="auto" referrerpolicy="no-referrer" sandbox="allow-scripts allow-same-origin"></iframe>
<a target="_blank" rel="noreferrer" href={extractedEntityUrl} >
<iframe src={extractedEntityUrl} title="Entity Preview" width="100%" height="auto" referrerpolicy="no-referrer" sandbox="allow-scripts allow-same-origin"></iframe>
</a>
<button on:click={() => window.open(entity.entitySpecificFields,'_blank')} class="active-app-button bg-slate-500 text-white py-2 px-4 rounded font-semibold">Visit Neighbor</button>
<button on:click={() => window.open(extractedEntityUrl,'_blank')} class="active-app-button bg-slate-500 text-white py-2 px-4 rounded font-semibold">Visit Neighbor</button>
{#if viewerIsSpaceOwner}
{#if linkDeletionInProgress}
<button disabled class="bg-slate-500 text-white py-2 px-4 rounded font-bold opacity-50 cursor-not-allowed">Deleting...</button>
Expand All @@ -66,7 +85,7 @@
{/if}
<button type="button" class="space-details-collapsible bg-slate-500 text-white py-2 px-4 rounded font-semibold">See Details</button>
<div class="space-details-content">
<p>Address: {entity.entitySpecificFields}</p>
<p>Address: {extractedEntityUrl}</p>
<p>Owner: {entity.owner}</p>
</div>
</div>
Expand Down
Loading