diff --git a/v1-com-officielle/public/DATA/peopleData.json b/v1-com-officielle/public/DATA/peopleData.json index 43fcd9a..0c9b796 100644 --- a/v1-com-officielle/public/DATA/peopleData.json +++ b/v1-com-officielle/public/DATA/peopleData.json @@ -1,125 +1,6 @@ [ { - "type": "folder", - "date": "33/33", - "isSelected": false, - "caption": "Artistes DRAGs", - "description": "Si tu veux en savoir plus sur nos artistes drags, c'est par ici !", - "children": [ - { - "type": "folder", - "date": "33/33", - "isSelected": false, - "caption": "Urazoria", - "description": "Urazoria est une Drag Creature de Limoges, et aussi une des fondatrice de drags & nerds, host de la 1ère édition", - "children": [ - { - "type": "image", - "date": "33/33", - "isSelected": false, - "caption": "Urazoria003.star", - "description": "Urazoria dans son show à XXXX pour XXXX en 2025", - "src":"./DATA/Images/ura-bleu.png", - "like": 0, - "isLiked": false - }, - { - "type": "text", - "date": "33/33", - "isSelected": false, - "caption": "Urazoria.loveMsg", - "description": "Coucou !" - } - ] - }, - { - "type": "text", - "date": "33/33", - "isSelected": false, - "caption": "Urazoria.loveMsg", - "description": "Coucou !" - } - ] - }, - { - "type": "folder", - "date": "33/33", - "isSelected": false, - "caption": "Artistes NERDs", - "description": "Si tu veux en savoir plus sur nos artistes nerds, c'est par là !", - "children": [ - { - "type": "folder", - "date": "33/33", - "isSelected": false, - "caption": "Théo", - "description": "Theo est un musicien qui construit des synthés modulaires", - "children": [ - { - "type": "link", - "date": "33/33", - "isSelected": false, - "caption": "Theo.web", - "description": "Réseaux de Theo", - "links":[ - { - "caption":"site web", - "url":"https://drags-nerds.net" - }, - { - "caption":"site web", - "url":"https://drags-nerds.net" - } - ] - }, - { - "type": "text", - "date": "33/33", - "isSelected": false, - "caption": "Theo.loveMsg", - "description": "Hello !" - } - ] - } - ] - }, - { - "type": "folder", - "date": "33/33", - "isSelected": false, - "caption": "Autres", - "description": "Dans ce dossier on met en vrac plein de trucs, qu'on trouve cool, sur nous (ou pas), nos valeurs etc. Allez fouiller si vous avez le temps ^^", - "children": [ - { - "type": "link", - "date": "33/33", - "isSelected": false, - "caption": "Background.web", - "description": "Site internet du fond animé, en open source, allez checker ça l'équipe ! (et payer un café à son créateur si vous pouvez hihi)", - "links":[ - { - "caption":"site web", - "url":"https://collidingscopes.github.io/liquid-shape-distortions" - } - ] - }, - { - "type": "text", - "date": "33/33", - "isSelected": false, - "caption": "DNN.loveMsg", - "description": "Hello again!" - }, - { - "type": "image", - "date": "33/33", - "isSelected": false, - "caption": "Urazoria003.star", - "description": "Urazoria dans son show à XXXX pour XXXX en 2025", - "src":"./DATA/Images/ura-vert.png", - "like": 0, - "isLiked": false - } - ] + "name": "vega", + "folder": 2 } ] diff --git a/v1-com-officielle/src/data/peopleData.js b/v1-com-officielle/src/data/peopleData.js index 3284fa2..6110410 100644 --- a/v1-com-officielle/src/data/peopleData.js +++ b/v1-com-officielle/src/data/peopleData.js @@ -1,4 +1,173 @@ -export async function loadPeopleData() { - const pData = await fetch('./DATA/peopleData.json'); - return await pData.json(); +function idAndDate(str){ + let data = str.split("T"); + let date = data[0].split("-"); + return { + date: date[2] +'/'+ date[1], + id: date[2] + date[1] + } +} + +function inlineContent(str){ + let data = str.split("
"); + let content = ""; + for (let line of data){ + content += line + '\n'; + } + return content +} + +function titleAndContent(str){ + let data = str.split(" :"); + let title = data[0]; + let contentData = data[1].split("
").filter(e => e); + let content = ""; + let src = []; + for(let line of contentData){ + if(line.includes('http')){ + let linkData = line.split("@"); + let linkNoFormat = linkData[1].split("\""); + let url = ""; + for(let el of linkNoFormat){ + if(el.includes('http')){ + url = el; + break + } else { + continue + } + } + src.push({ + caption: linkData[0], + url: url + }) + } else { + content += line + '\n'; + } + } + return { + title: title, + content: content, + links: src, + } +} + +export async function loadPeopleData() { + const usernamesRes = await fetch('./DATA/peopleData.json'); + const pData = await usernamesRes.json(); + const res = await fetch("https://pouet.drags-nerds.net/api/v1/timelines/public?local=true&limit=40"); + + if (!res.ok) + throw new Error(`Server responded with ${res.status} ${res.statusText}`); + + const pouets = await res.json(); + const filtered = pouets.filter(p => pData.some(user => p.account.display_name === user.name)); + const files = {}; + for (const user of pData) { + files[user.name] = []; + } + const description = {}; + for (const user of pData){ + const pouet = filtered.find(p => p.account.display_name === user.name); + if (pouet){ + description[user.name] = pouet.account.note; + } + } + + for (const pouet of filtered) { + const username = pouet.account.display_name; + let infos = idAndDate(pouet.created_at); + let entry; + + //ignorer autres que images + if (pouet.media_attachments?.length > 0 && + !pouet.media_attachments[0].type.includes('image')) { + continue; + } + + if (pouet.content.includes('http')) { + let textInfos = titleAndContent(pouet.content); + entry = { + id: 'link' + username + infos.id, + date: infos.date, + dateInfo: pouet.created_at, + type: "link", + author: username, + caption: textInfos.title + '.liens', + links: textInfos.links, + description: textInfos.content, + isSelected: false + }; + } else if (pouet.media_attachments?.length > 0) { + let textInfos = titleAndContent(pouet.content); + entry = { + id: 'img' + username + infos.id, + date: infos.date, + dateInfo: pouet.created_at, + type: "image", + author: username, + caption: textInfos.title + '.star', + src: pouet.media_attachments[0].url, + description: textInfos.content, + like: pouet.favourites_count, + isSelected: false + } + } else { + let textInfos = titleAndContent(pouet.content); + entry = { + id: 'txt' + username + infos.id, + date: infos.date, + dateInfo: pouet.created_at, + type: "text", + author: username, + caption: textInfos.title + '.msg', + description: textInfos.content, + isSelected: false + }; + } + files[username].push(entry); + } + + const dragContent = pData.filter(user => user.folder === 0).map(user => ( + { + type: "folder", + caption: user.name + '.info', + children: files[user.name], + description: description[user.name], + isSelected: false + })); + const nerdContent = pData.filter(user => user.folder === 1).map(user => ( + { + type: "folder", + caption: user.name + '.info', + children: files[user.name], + description: description[user.name], + isSelected: false + })); + + const otherContent = pData.filter(user => user.folder === 2).flatMap(user => files[user.name]); + + + const sortedContent = [ + { + type: "folder", + caption : "Artistes Drags", + description:"Pour en savoir plus sur nos artistes drags, c'est par ici !", + children: dragContent, + isSelected: false + }, + { + type: "folder", + caption : "Artistes Nerds", + description:"Pour en savoir plus sur nos artistes nerds, c'est par là !", + children: nerdContent, + isSelected: false + }, + { + type: "folder", + caption : "Autres contenus", + description:"Dans cette section, on place pleins de contenu, en vrac, \n sur nous, nos copaines, des trucs qu'on trouve cool, etc.", + children: otherContent, + isSelected: false + } + ]; + return sortedContent; } diff --git a/v1-com-officielle/src/indieComponents/ArtistPannel.vue b/v1-com-officielle/src/indieComponents/ArtistPannel.vue index 53c728d..46dd629 100644 --- a/v1-com-officielle/src/indieComponents/ArtistPannel.vue +++ b/v1-com-officielle/src/indieComponents/ArtistPannel.vue @@ -35,17 +35,17 @@

Oops! There is nothing to display here...

-
+

{{item.caption}}

-
+

{{item.caption}}

-

*auteurice*

-

{{item.date}}

+

{{item.author}}

+

@@ -258,7 +258,7 @@ border-width: thin; border-color: transparent; border-radius: 16.1px; - overflow-x: hidden; + overflow: hidden; } .listItemStyle:hover{ @@ -358,9 +358,10 @@ this.isNotRoot = true; this.displayedDescription = e.description this.fileName += e.caption + '/'; - if (e.caption === 'Autres'){ + if (e.caption === 'Autres contenus'){ this.gridDisplay = false; this.listDisplay = true; + this.organizeItems(); } } if(e.type === 'image'){ @@ -387,9 +388,11 @@ }, selectFile(e){ - this.displayedItems.forEach(it => { + console.log(e); + if(!this.emptyFolder){ + this.displayedItems.forEach(it => { it.isSelected = false; - }) + })} e.isSelected = true; this.displayedDescription = e.description; }, @@ -419,20 +422,27 @@ this.emptyFolder = false; } }, + organizeItems(){ + this.displayedItems.sort((a,b) => b.dateInfo.localeCompare(a.dateInfo)); + }, backToRoot(){ this.displayedItems = this.rootFolderContent.at(-1).content; this.fileName = this.rootFolderContent.at(-1).directory; - this.rootDepth = this.rootFolderContent.length - if (this.rootDepth === 0){ - this.isNotRoot = false; + if(this.emptyFolder){ + this.emptyFolder = false; + this.gridDisplay = true; } - this.checkEmptyFolder(); if(this.listDisplay){ this.listDisplay = false; this.gridDisplay = true; } this.deselectAll(); this.rootFolderContent.splice(this.rootFolderContent.length-1,1); + this.rootDepth = this.rootFolderContent.length + if (this.rootDepth === 0){ + this.isNotRoot = false; + } + console.log(this.rootDepth); }, closeClicked(){ this.dataFirstLoad();