vemonet / shapes-of-you

💠 An index for linked open data & standard knowledge descriptions (ontologies, vocabularies, shapes, queries, mappings)
http://index.semanticscience.org
MIT License
38 stars 6 forks source link

Implement SOLID #3

Open vemonet opened 3 years ago

vemonet commented 3 years ago

Checkout the SOLID React SDK docs: https://docs.inrupt.com/developer-tools/javascript/react-sdk/

Seems only to be UI components to edit the SOLID user profile

Try: https://github.com/solid/react-components (and https://github.com/solid/query-ldflex)

solid.data['https://ruben.verborgh.org/profile/#me']['https://maastrichtu-ids.github.io/shapes-of-you#preferences'] = 1

Replace Like by Star? https://github.com/solid/react-components#-social-interactions

Use this URI to store preferences in SOLID pod: https://maastrichtu-ids.github.io/shapes-of-you#preferences

Example to create a custom Star button:

star.tsx:

import { customActivityButton } from './ActivityButton';

/** Button to view and perform a "Star" action on an item. */
export default customActivityButton('ShapeStar', 'Star', 'You starred', 'Starred');

Then star it:

<Star object="https://shape-file-url">Star Icon</Star>
vemonet commented 3 years ago

Quickly implemented with built-in <Like> SOLID React component

It seems to require to have created a public folder in the pod: https://vemonet.solidcommunity.net/public/activities

Uncaught (in promise) Error: Could not retrieve https://vemonet.solidcommunity.net/public/activities (404: Not Found)

Also authorize the app to edit your SOLID pod in your SOLID pod profile: https://vemonet.solidcommunity.net/profile/card

In Edit your profile > Preferences tab

Edit Manage your trusted applications to add: https://maastrichtu-ids.github.io/shapes-of-you with Read, Write, Access and Control authorizations

Clicking on Like button showed this error at start:

PATCHhttps://vemonet.solidcommunity.net/public/activities
[HTTP/1.1 403 Origin Unauthorized 340ms]

@solid/react-components Error: Update query failed (403): Origin Unauthorized
    next SolidUpdateEngine.js:54
    processResults CreateActivityHandler.js:40
    handle ActivityHandler.js:66

Now, it shows this error:

@solid/react-components Error: Update query failed (500): Internal Server Error
    next SolidUpdateEngine.js:54
    processResults CreateActivityHandler.js:40
    handle ActivityHandler.js:66
vemonet commented 3 years ago

Currently adding data to a pod fails due to permissions issue. But the user name is properly retrieved, and displayed!

To give permissions to Shapes of you to add data to your pod: