diff --git a/staff/pere-hernandez/app/isdigram copy 2/Component.js b/staff/pere-hernandez/app/isdigram copy 2/Component.js deleted file mode 100644 index c270f18e6..000000000 --- a/staff/pere-hernandez/app/isdigram copy 2/Component.js +++ /dev/null @@ -1,57 +0,0 @@ -function Component(tag){ - this._container = document.createElement(tag) -} - -Component.prototype.assembleTo = function (element) { - //validation - - if (!(element instanceof HTMLElement)) - throw new TypeError ('element is not an HTMLElement') - - //logic - element.appendChild(this._container) -} - -Component.prototype.add = function () { - //validation - - Array.prototype.forEach.call(arguments, function (child){ - - if (!(child instanceof Component)) - throw new TypeError ('child is not a Component') - }) - - //logic - Array.prototype.forEach.call(arguments, function (child){ - this._container.appendChild(child._container) - }.bind(this)) -} - -Component.prototype.setText = function (text){ - //validation - - if (typeof text !== 'string') - throw new TypeError('text is not a string') - - //logic - this._container.innerText = text -} - -Component.prototype.setId = function (id) { - //validation - - if (typeof id !== 'string') - throw new TypeError ('id is not a string') - - //logic - this._container.id = id -} - -Component.prototype.onClick = function (callback) { - //validation - if (!(callback instanceof Function)) - throw new TypeError ('callback is not a function') - - //logic - this._container.onclick = callback -} \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy 2/README.md b/staff/pere-hernandez/app/isdigram copy 2/README.md deleted file mode 100644 index 0cbe0721d..000000000 --- a/staff/pere-hernandez/app/isdigram copy 2/README.md +++ /dev/null @@ -1,28 +0,0 @@ -# ISDIGram - -## Functional Description - -### Functionalities - -- Crate a post - - take picture with camera - - upload picture from phone - - apply filter to picture - - Tag a user -- View other people's posts -- Send messages -- Follow user -- Search user -- Search post (by hashtag) -- Toggle like a post -- Toggle save a post -- Comment a post -- Video-call user -- Live video streaming -- Publsh a story - -### UI Design - -#### Layout - -#### Prototype \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy 2/add-circle-fill-system.256x256.png b/staff/pere-hernandez/app/isdigram copy 2/add-circle-fill-system.256x256.png deleted file mode 100644 index 0de6a034c..000000000 Binary files a/staff/pere-hernandez/app/isdigram copy 2/add-circle-fill-system.256x256.png and /dev/null differ diff --git a/staff/pere-hernandez/app/isdigram copy 2/chat-logo.png b/staff/pere-hernandez/app/isdigram copy 2/chat-logo.png deleted file mode 100644 index ad1de9de9..000000000 Binary files a/staff/pere-hernandez/app/isdigram copy 2/chat-logo.png and /dev/null differ diff --git a/staff/pere-hernandez/app/isdigram copy 2/chat.svg b/staff/pere-hernandez/app/isdigram copy 2/chat.svg deleted file mode 100644 index f7cdb7bbe..000000000 --- a/staff/pere-hernandez/app/isdigram copy 2/chat.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy 2/data/Collection.mjs b/staff/pere-hernandez/app/isdigram copy 2/data/Collection.mjs deleted file mode 100644 index 869432f40..000000000 --- a/staff/pere-hernandez/app/isdigram copy 2/data/Collection.mjs +++ /dev/null @@ -1,132 +0,0 @@ -class Collection { - constructor (name){ - this.name = name - } - -//helpers - - _generateId() { - return (+((parseInt(Math.random() * 10 ** 17)).toString())).toString(36) - } - - _loadDocuments () { - var documentsJSON = localStorage[this.name] - - var documents = JSON.parse(documentsJSON || '[]') - - return documents - } - - _saveDocuments (documents) { - //validation - - if (!(documents instanceof Array)) - throw new TypeError ('documents is not an Array') - - documents.forEach(function (document){ - if(!(document instanceof Object)) - throw new TypeError('some elements in documents are not a document') - }) - - //logic - var documentsJSON = JSON.stringify(documents) - - localStorage[this.name] = documentsJSON - } - - _backup (){ - localStorage[this.name + '_backup'] = localStorage[this.name] - } - - _restore (){ - localStorage[this.name] = localStorage[this.name + '_backup'] - } - - - - // CRUD - - findOne (callback) { - //validation - - if (!(callback instanceof Function)) - throw new TypeError ('callback is not a Function') - - //logic - var documents = this._loadDocuments() - - var document = documents.find(callback) - - return document - } - - insertOne (document) { - //validation - - if (!(document instanceof Object)) - throw new TypeError ('document is not an Object') - - //logic - var documents = this._loadDocuments() - - document.id = this._generateId() - - documents.push(document) - - this._saveDocuments(documents) - } - - updateOne (document) { - //validation - - if (!(document instanceof Object)) - throw new TypeError('document is not an Object') - if (typeof document.id !== 'string') - throw new TypeError('id must be a string') - - //logic - var documents = this._loadDocuments() - - var index = documents.findIndex(function (document2) { - return document2.id === document.id - }) - - if (index > -1){ - documents.splice(index, 1, document) - - this._saveDocuments(documents) - } - } - - deleteOne (callback){ - //validation - - if (!(callback instanceof Function)) - throw new TypeError ('callback is not a Function') - - //logic - var documents = this._loadDocuments() - - var index = documents.findIndex(callback) - - if (index > -1){ - documents.splice(index, 1) - - this._saveDocuments(documents) - } - } - - getAll (){ - var documents = this._loadDocuments() - - return documents - } - - printAll () { - var documents = this._loadDocuments() - - console.table(documents) - } -} - -export default Collection \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy 2/data/Collection.spec.html b/staff/pere-hernandez/app/isdigram copy 2/data/Collection.spec.html deleted file mode 100644 index b95b90519..000000000 --- a/staff/pere-hernandez/app/isdigram copy 2/data/Collection.spec.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - Collection spec - - - -

Collection spec

- - - - - - - \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy 2/data/Collection.spec.js b/staff/pere-hernandez/app/isdigram copy 2/data/Collection.spec.js deleted file mode 100644 index 08c5a8aed..000000000 --- a/staff/pere-hernandez/app/isdigram copy 2/data/Collection.spec.js +++ /dev/null @@ -1,592 +0,0 @@ -import Collection from "./Collection" - -describe('Collection', () => { - describe('constructor', () => { - it('creates a collection', () => { - var cars = new Collection('cars') - - expect(cars).toBeInstanceOf(Collection) - }) - }) - - - - - describe('> helpers', () => { - describe('_generateId', () => { - it('generates an id', () => { - var cars = new Collection('cars') - - var id1 = cars._generateId() - - expect(typeof id1).toBe('string') - - var id2 = cars._generateId() - - expect(typeof id2).toBe('string') - - expect(id1 === id2).toBe(false) - - delete (localStorage.cars) - }) - }) - - - - describe('_loadDocuments', () => { - it('loads empty array on a new collection', () => { - delete (localStorage.cars) - - var cars = new Collection('cars') - - var documents = cars._loadDocuments() - - expect(documents).toBeInstanceOf(Array) - expect(documents.length).toBe(0) - }) - - it('loads data on non-empty collection', () => { - delete (localStorage.cars) - - localStorage.cars = '[{"brand": "Renault", "model": "Megane"}, {"brand": "Peugeot", "model": "208"}]' - - var cars = new Collection('cars') - - var documents = cars._loadDocuments() - - expect(documents).toBeInstanceOf(Array) - expect(documents.length).toBe(2) - - expect(documents[0]).toBeInstanceOf(Object) - expect(documents[0].brand).toBe('Renault') - expect(documents[0].model).toBe('Megane') - - expect(documents[1]).toBeInstanceOf(Object) - expect(documents[1].brand).toBe('Peugeot') - expect(documents[1].model).toBe('208') - - delete (localStorage.cars) - }) - }) - - - - describe('_saveDocuments', () => { - it('should save a collection', () => { - delete (localStorage.cars) - - var documents = [{"brand": "Renault", "model": "Megane"}, {"brand": "Peugeot", "model": "208"}] - - var cars = new Collection ('cars') - - cars._saveDocuments(documents) - - expect(!!localStorage.cars).toBe(true) - expect(typeof localStorage.cars).toBe('string') - - var documentsString = '[{"brand":"Renault","model":"Megane"},{"brand":"Peugeot","model":"208"}]' - - expect(localStorage.cars).toBe(documentsString) - - delete (localStorage.cars) - }) - - it('should fail on non-Array documents', () => { - delete (localStorage.cars) - - var documents = 'I am not an Array' - - var cars = new Collection('cars') - - var errorThrown - - try { - cars._saveDocuments(documents) - } catch (error) { - errorThrown = error - } - - expect(!!localStorage.cars).toBe(false) - - expect(errorThrown).toBeInstanceOf(TypeError) - expect(errorThrown.message).toBe('documents is not an Array') - - delete (localStorage.cars) - }) - - it('should fail on documents being an Array of non-documents', function (){ - delete (localStorage.cars) - - var documents = ['I am not an Object', 123] - - var cars = new Collection('cars') - - var errorThrown - - try { - cars._saveDocuments(documents) - } catch (error) { - errorThrown = error - } - - expect(!!localStorage.cars).toBe(false) - - expect(errorThrown).toBeInstanceOf(TypeError) - expect(errorThrown.message).toBe('some elements in documents are not a document') - - delete (localStorage.cars) - }) - }) - - - - describe('_backup', () => { - it('should create a backup copy', () => { - delete (localStorage.cars) - delete (localStorage.cars_backup) - - localStorage.cars = '[{"brand":"Renault","model":"Megane"},{"brand":"Peugeot","model":"208"}]' - - var cars = new Collection('cars') - - cars._backup() - - expect(!!localStorage.cars_backup).toBe(true) - - expect(localStorage.cars_backup).toBe(localStorage.cars) - - delete (localStorage.cars) - delete (localStorage.cars_backup) - }) - }) - - - - describe('_restore', () => { - it('should restore a collection', () => { - delete (localStorage.cars) - delete (localStorage.cars_backup) - - localStorage.cars_backup = '[{"brand":"Renault","model":"Megane"},{"brand":"Peugeot","model":"208"}]' - - var cars = new Collection('cars') - - cars._restore() - - expect(!!localStorage.cars).toBe(true) - - expect(localStorage.cars).toBe(localStorage.cars_backup) - - delete (localStorage.cars) - delete (localStorage.cars_backup) - }) - }) - }) - - - - - describe('> CRUD', () => { - describe('findOne', () => { - it('should find an existing document', () => { - delete (localStorage.cars) - delete (localStorage.cars_backup) - - localStorage.cars = '[{"brand":"Renault","model":"Megane"},{"brand":"Peugeot","model":"208"}]' - - var cars = new Collection('cars') - - var car = cars.findOne(function (car){ - return car.brand === 'Renault' - }) - - expect(!!car).toBe(true) - expect(car).toBeInstanceOf(Object) - expect(car.brand).toBe('Renault') - expect(car.model).toBe('Megane') - - delete (localStorage.cars) - delete (localStorage.cars_backup) - }) - - it('should return undefined on no matches', () => { - delete (localStorage.cars) - delete (localStorage.cars_backup) - - localStorage.cars = '[{"brand":"Renault","model":"Megane"},{"brand":"Peugeot","model":"208"}]' - - var cars = new Collection('cars') - - var car = cars.findOne(function (car){ - return car.brand === 'Fiat' - }) - - expect(!!car).toBe(false) - expect(car).toBe(undefined) - - delete (localStorage.cars) - delete (localStorage.cars_backup) - }) - - it('should fail on callback not a function', () => { - delete (localStorage.cars) - - localStorage.cars = '[{"brand":"Renault","model":"Megane"},{"brand":"Peugeot","model":"208"}]' - - var cars = new Collection('cars') - - var errorThrown - - try { - var car = cars.findOne('I am not a Function') - } catch (error) { - errorThrown = error - } - - expect(!!car).toBe(false) - - expect(errorThrown).toBeInstanceOf(TypeError) - expect(errorThrown.message).toBe('callback is not a Function') - - delete (localStorage.cars) - }) - }) - - - - describe('insertOne', () => { - it('should insert a document in a collection', () => { - delete (localStorage.cars) - - localStorage.cars = '[{"brand":"Renault","model":"Megane"},{"brand":"Peugeot","model":"208"}]' - - var cars = new Collection('cars') - - var car = {brand: 'Toyota', model: 'Yaris'} - - cars.insertOne(car) - - parsedCars = JSON.parse(localStorage.cars) - - expect(!!localStorage.cars).toBe(true) - expect(parsedCars.length).toBe(3) - - expect(parsedCars[0].brand).toBe('Renault') - expect(parsedCars[0].model).toBe('Megane') - - expect(parsedCars[1].brand).toBe('Peugeot') - expect(parsedCars[1].model).toBe('208') - - expect(parsedCars[2].brand).toBe('Toyota') - expect(parsedCars[2].model).toBe('Yaris') - - delete (localStorage.cars) - }) - - - it('should not work on non-Object document', () => { - delete (localStorage.cars) - - localStorage.cars = '[{"brand":"Renault","model":"Megane"},{"brand":"Peugeot","model":"208"}]' - - var cars = new Collection ('cars') - - var car = 'I am not an Object' - - var errorThrown - - try { - cars.insertOne(car) - } catch (error) { - errorThrown = error - } - - parsedCars = JSON.parse(localStorage.cars) - - expect(!!localStorage.cars).toBe(true) - expect(parsedCars.length).toBe(2) - - expect(parsedCars[0].brand).toBe('Renault') - expect(parsedCars[0].model).toBe('Megane') - - expect(parsedCars[1].brand).toBe('Peugeot') - expect(parsedCars[1].model).toBe('208') - - expect(errorThrown).toBeInstanceOf(TypeError) - expect(errorThrown.message).toBe('document is not an Object') - - delete (localStorage.cars) - }) - }) - - - - describe('updateOne', () => { - it('should find a document in its Collection and change its values', () => { - delete (localStorage.cars) - - localStorage.cars = '[{"brand":"Renault","model":"Megane","id":"1"},{"brand":"Peugeot","model":"208","id":"2"}]' - - var cars = new Collection('cars') - - var car = {brand: 'Toyota', model: 'Yaris', id: "1"} - - cars.updateOne(car) - - var parsedCars = JSON.parse(localStorage.cars) - - expect(!!parsedCars).toBe(true) - expect(parsedCars.length).toBe(2) - - expect(parsedCars[0].brand).toBe('Toyota') - expect(parsedCars[0].model).toBe('Yaris') - expect(parsedCars[0].id).toBe("1") - - expect(parsedCars[1].brand).toBe('Peugeot') - expect(parsedCars[1].model).toBe('208') - expect(parsedCars[1].id).toBe("2") - - delete (localStorage.cars) - }) - - - it('should fail on no matches', () => { - delete (localStorage.cars) - - localStorage.cars = '[{"brand":"Renault","model":"Megane"},{"brand":"Peugeot","model":"208"}]' - - var cars = new Collection('cars') - - var car = {brand: 'Toyota', model: 'Yaris', id: '1'} - - cars.updateOne(car) - - var parsedCars = JSON.parse(localStorage.cars) - - expect(!!parsedCars).toBe(true) - expect(parsedCars.length).toBe(2) - - expect(parsedCars[0].brand).toBe('Renault') - expect(parsedCars[0].model).toBe('Megane') - - expect(parsedCars[1].brand).toBe('Peugeot') - expect(parsedCars[1].model).toBe('208') - - delete (localStorage.cars) - }) - - - it('should fail on non-Object document', () => { - delete (localStorage.cars) - - localStorage.cars = '[{"brand":"Renault","model":"Megane","id":"1"},{"brand":"Peugeot","model":"208","id":"2"}]' - - var cars = new Collection('cars') - - var car = 'I am not an Object' - - var errorThrown - - try { - cars.updateOne(car) - } catch (error) { - errorThrown = error - } - - parsedCars = JSON.parse(localStorage.cars) - - expect(!!parsedCars).toBe(true) - expect(parsedCars.length).toBe(2) - - expect(parsedCars[0].brand).toBe('Renault') - expect(parsedCars[0].model).toBe('Megane') - expect(parsedCars[0].id).toBe("1") - - expect(parsedCars[1].brand).toBe('Peugeot') - expect(parsedCars[1].model).toBe('208') - expect(parsedCars[1].id).toBe("2") - - expect(errorThrown).toBeInstanceOf(TypeError) - expect(errorThrown.message).toBe('document is not an Object') - - delete (localStorage.cars) - }) - - it ('should fail on non-string document.id', () => { - delete (localStorage.cars) - - localStorage.cars = '[{"brand":"Renault","model":"Megane","id":"1"},{"brand":"Peugeot","model":"208","id":"2"}]' - - var cars = new Collection('cars') - - var car = {brand: 'Toyota', model: 'Yaris', id: 1} - - var errorThrown - - try { - cars.updateOne(car) - } catch (error) { - errorThrown = error - } - - var parsedCars = JSON.parse(localStorage.cars) - - expect(!!parsedCars).toBe(true) - expect(parsedCars.length).toBe(2) - - expect(parsedCars[0].brand).toBe('Renault') - expect(parsedCars[0].model).toBe('Megane') - expect(parsedCars[0].id).toBe("1") - - expect(parsedCars[1].brand).toBe('Peugeot') - expect(parsedCars[1].model).toBe('208') - expect(parsedCars[1].id).toBe("2") - - expect(errorThrown).toBeInstanceOf(TypeError) - expect(errorThrown.message).toBe('id must be a string') - - delete (localStorage.cars) - }) - }) - - - - describe('deleteOne', () => { - it('should delete document from Collection', () => { - delete (localStorage.cars) - - localStorage.cars = '[{"brand":"Renault","model":"Megane","id":"1"},{"brand":"Peugeot","model":"208","id":"2"}]' - - var cars = new Collection('cars') - - var car = {brand: 'Renault', model: 'Megane', id: "1"} - - cars.deleteOne(function (car1){ - return car1.id === car.id - }) - - parsedCars = JSON.parse(localStorage.cars) - - expect(!!parsedCars).toBe(true) - expect(parsedCars.length).toBe(1) - - expect(parsedCars[0].brand).toBe('Peugeot') - expect(parsedCars[0].model).toBe('208') - expect(parsedCars[0].id).toBe('2') - - delete (localStorage.cars) - }) - - - it('should fail on no matches', () => { - delete (localStorage.cars) - - localStorage.cars = '[{"brand":"Renault","model":"Megane","id":"1"},{"brand":"Peugeot","model":"208","id":"2"}]' - - var cars = new Collection('cars') - - var car = {brand: 'Toyota', model: 'Yaris', id: '3'} - - cars.deleteOne(function (car1){ - return car1.id === car.id - }) - - parsedCars = JSON.parse(localStorage.cars) - - expect(!!parsedCars).toBe(true) - expect(parsedCars.length).toBe(2) - - expect(parsedCars[0].brand).toBe('Renault') - expect(parsedCars[0].model).toBe('Megane') - expect(parsedCars[0].id).toBe('1') - - expect(parsedCars[1].brand).toBe('Peugeot') - expect(parsedCars[1].model).toBe('208') - expect(parsedCars[1].id).toBe('2') - - delete (localStorage.cars) - }) - - - it('should fail on non-Function callback', () => { - delete (localStorage.cars) - - localStorage.cars = '[{"brand":"Renault","model":"Megane","id":"1"},{"brand":"Peugeot","model":"208","id":"2"}]' - - var cars = new Collection('cars') - - var car = {brand: 'Renault', model: 'Megane', id: '1'} - - var errorThrown - - try { - cars.deleteOne(car) - } catch (error) { - errorThrown = error - } - - parsedCars = JSON.parse(localStorage.cars) - - expect(!!parsedCars).toBe(true) - expect(parsedCars.length).toBe(2) - - expect(parsedCars[0].brand).toBe('Renault') - expect(parsedCars[0].model).toBe('Megane') - expect(parsedCars[0].id).toBe('1') - - expect(parsedCars[1].brand).toBe('Peugeot') - expect(parsedCars[1].model).toBe('208') - expect(parsedCars[1].id).toBe('2') - - expect(errorThrown).toBeInstanceOf(TypeError) - expect(errorThrown.message).toBe('callback is not a Function') - - delete (localStorage.cars) - }) - }) - - - - describe('getAll', () => { - it('should return an Array of documents', () => { - delete (localStorage.cars) - - localStorage.cars = '[{"brand":"Renault","model":"Megane","id":"1"},{"brand":"Peugeot","model":"208","id":"2"}]' - - var cars = new Collection('cars') - - documents = cars.getAll() - - expect(!!documents).toBe(true) - expect(Array.isArray(documents)).toBe(true) - expect(documents.length).toBe(2) - - expect(documents[0].brand).toBe('Renault') - expect(documents[0].model).toBe('Megane') - expect(documents[0].id).toBe('1') - - expect(documents[1].brand).toBe('Peugeot') - expect(documents[1].model).toBe('208') - expect(documents[1].id).toBe('2') - - delete (localStorage.cars) - }) - }) - - - - describe('printAll', () => { - it('should print a table of a Collection', () => { - delete (localStorage.cars) - - localStorage.cars = '[{"brand":"Renault","model":"Megane","id":"1"},{"brand":"Peugeot","model":"208","id":"2"}]' - - var cars = new Collection('cars') - - cars.printAll() - - delete (localStorage.cars) - }) - }) - }) -}) \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy 2/data/index.js b/staff/pere-hernandez/app/isdigram copy 2/data/index.js deleted file mode 100644 index 1bfbceeae..000000000 --- a/staff/pere-hernandez/app/isdigram copy 2/data/index.js +++ /dev/null @@ -1,9 +0,0 @@ -import Collection from "./Collection.mjs" - -const data = { - users: new Collection('users'), - posts: new Collection('posts'), - chats: new Collection('chats') -} - -export default data \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy 2/home.png b/staff/pere-hernandez/app/isdigram copy 2/home.png deleted file mode 100644 index 24ba4ea71..000000000 Binary files a/staff/pere-hernandez/app/isdigram copy 2/home.png and /dev/null differ diff --git a/staff/pere-hernandez/app/isdigram copy 2/home/components/Button.js b/staff/pere-hernandez/app/isdigram copy 2/home/components/Button.js deleted file mode 100644 index f75584342..000000000 --- a/staff/pere-hernandez/app/isdigram copy 2/home/components/Button.js +++ /dev/null @@ -1,17 +0,0 @@ -function Button(){ - Component.call(this, 'button') -} - -Button.prototype = Object.create(Component.prototype) -Button.prototype.constructor = Button - -Button.prototype.setType = function (type) { - //validation - - if (typeof type !== 'string') - throw new TypeError ('type is not a strig') - - //logic - - this._container.for = type -} \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy 2/home/components/Footer.js b/staff/pere-hernandez/app/isdigram copy 2/home/components/Footer.js deleted file mode 100644 index eac5f368e..000000000 --- a/staff/pere-hernandez/app/isdigram copy 2/home/components/Footer.js +++ /dev/null @@ -1,23 +0,0 @@ -function Footer (){ - Component.call(this, 'footer') - - var createPostButton = new Button - createPostButton.setId('create-post-button') - - var createPostImage = new Image - createPostImage.setSource('../add-circle-fill-system.256x256.png') - createPostImage.setId('create-post-img') - - createPostButton.add(createPostImage) - - createPostButton.onClick(function (){ - var postFormSection = new PostFormSection - - home.add(postFormSection) - }) - - this.add(createPostButton) -} - -Footer.prototype = Object.create(Component.prototype) -Footer.prototype.constructor = Footer \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy 2/home/components/Header.js b/staff/pere-hernandez/app/isdigram copy 2/home/components/Header.js deleted file mode 100644 index 72cafc6df..000000000 --- a/staff/pere-hernandez/app/isdigram copy 2/home/components/Header.js +++ /dev/null @@ -1,25 +0,0 @@ -function Header() { - Component.call(this, 'header') - - var logo = new Logo - logo.setId('logo') - - var logoutButton = new Button - logoutButton.setText('Logout') - logoutButton.setId('logout-button') - - logoutButton.onClick(function (){ - try { - logic.logoutUser() - - location.href = '../login' - } catch (error) { - alert(error.message) - } - }) - - this.add(logo, logoutButton) -} - -Header.prototype = Object.create(Component.prototype) -Header.prototype.constructor = Header \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy 2/home/components/Image.js b/staff/pere-hernandez/app/isdigram copy 2/home/components/Image.js deleted file mode 100644 index 4af826c06..000000000 --- a/staff/pere-hernandez/app/isdigram copy 2/home/components/Image.js +++ /dev/null @@ -1,16 +0,0 @@ -function Image(){ - Component.call(this, 'img') -} - -Image.prototype = Object.create(Component.prototype) -Image.prototype.constructor = Image - -Image.prototype.setSource = function (source) { - //validation - - if (typeof source !== 'string') - throw new TypeError ('source is not a string') - - //logic - this._container.src = source -} \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy 2/home/components/Input.js b/staff/pere-hernandez/app/isdigram copy 2/home/components/Input.js deleted file mode 100644 index f60f60c5d..000000000 --- a/staff/pere-hernandez/app/isdigram copy 2/home/components/Input.js +++ /dev/null @@ -1,15 +0,0 @@ -function Input (){ - Component.call(this, 'input') -} - -Input.prototype = Object.create(Component.prototype) -Input.prototype.constructor = Input - -Input.prototype.setType = function (type) { - //validation - - if (typeof type !== 'string') - - //logic - this._container.type = type -} \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy 2/home/components/Label.js b/staff/pere-hernandez/app/isdigram copy 2/home/components/Label.js deleted file mode 100644 index 3d909e9d1..000000000 --- a/staff/pere-hernandez/app/isdigram copy 2/home/components/Label.js +++ /dev/null @@ -1,15 +0,0 @@ -function Label () { - Component.call(this, 'label') -} - -Label.prototype = Object.create(Component.prototype) -Label.prototype.constructor = Label - -Label.prototype.setFor = function (forId) { - //validation - - if (typeof forId !== 'string') - throw new TypeError ('forId is not a string') - - this._container.for = forId -} \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy 2/home/components/Logo.js b/staff/pere-hernandez/app/isdigram copy 2/home/components/Logo.js deleted file mode 100644 index 65dd38e5f..000000000 --- a/staff/pere-hernandez/app/isdigram copy 2/home/components/Logo.js +++ /dev/null @@ -1,16 +0,0 @@ -function Logo() { - Component.call(this, 'div') - - var logoImg = new Image - logoImg.setSource('../logo.png') - logoImg.setId('logo-img') - - var logoTitle = new Component('h1') - logoTitle.setText('Isdigram.') - logoTitle.setId('logo-title') - - this.add(logoImg, logoTitle) -} - -Logo.prototype = Object.create(Component.prototype) -Logo.prototype.constructor = Logo \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy 2/home/components/Menu.js b/staff/pere-hernandez/app/isdigram copy 2/home/components/Menu.js deleted file mode 100644 index d30a20037..000000000 --- a/staff/pere-hernandez/app/isdigram copy 2/home/components/Menu.js +++ /dev/null @@ -1,16 +0,0 @@ -function Menu (){ - Component.call(this, 'nav') - - var chatButton = new Button - chatButton.setId('chat-icon-button') - - var chatImage = new Image - chatImage.setSource('../chat.svg') - - chatButton.add(chatImage) - - this.add(chatButton) -} - -Menu.prototype = Object.create(Component.prototype) -Menu.prototype.constructor = Menu \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy 2/home/components/Post.js b/staff/pere-hernandez/app/isdigram copy 2/home/components/Post.js deleted file mode 100644 index 023142fbc..000000000 --- a/staff/pere-hernandez/app/isdigram copy 2/home/components/Post.js +++ /dev/null @@ -1,32 +0,0 @@ -function Post (post){ - Component.call(this, 'article') - - var author = new Component('h3') - author.setText(post.author.username) - - var photo = new Image - photo.setSource(post.photo) - - var photoDiv = new Component('div') - photoDiv.setId('photo-div') - - photoDiv.add(photo) - - var comment = new Component('p') - comment.setText(post.comment) - - var date = new Component('time') - date.setText(post.date) - - this.add(author, photoDiv, comment, date) - - if (post.author.id === logic.getLoggedInUserId()){ - var postButtonsBar = new PostButtonsBar - postButtonsBar.setId('post-buttons-bar') - - this.add(postButtonsBar) - } -} - -Post.prototype = Object.create(Component.prototype) -Post.prototype.constructor = Post \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy 2/home/components/PostButtonsBar.js b/staff/pere-hernandez/app/isdigram copy 2/home/components/PostButtonsBar.js deleted file mode 100644 index 5977ccc67..000000000 --- a/staff/pere-hernandez/app/isdigram copy 2/home/components/PostButtonsBar.js +++ /dev/null @@ -1,16 +0,0 @@ -function PostButtonsBar (){ - Component.call(this, 'div') - - var deletePostButton = new Button - deletePostButton.setText('Delete') - deletePostButton.setId('delete-post-button') - - var editPostButton = new Button - editPostButton.setText('Edit') - editPostButton.setId('edit-post-button') - - this.add(deletePostButton, editPostButton) -} - -PostButtonsBar.prototype = Object.create(Component.prototype) -PostButtonsBar.prototype.constructor = PostButtonsBar \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy 2/home/components/PostForm.js b/staff/pere-hernandez/app/isdigram copy 2/home/components/PostForm.js deleted file mode 100644 index 9a9b40a96..000000000 --- a/staff/pere-hernandez/app/isdigram copy 2/home/components/PostForm.js +++ /dev/null @@ -1,22 +0,0 @@ -function PostForm () { - Component.call(this, 'form') - - var photoInputLabel = new Label - - var photoInput = new Input - photoInput.setType('text') - photoInput.setId('photo-input') - photoInputLabel.setFor('photo-input') - - var commentInputLabel = new Label - - var commentInput = new Input - commentInput.setType ('text') - commentInput.setId('comment-input') - commentInputLabel.setFor('comment-input') - - var submitPostFormButton = new Button - submitPostFormButton.setId('submit-post-form-button') - - this.add(photoInputLabel, photoInput, commentInputLabel, commentInput, submitPostFormButton) -} \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy 2/home/components/PostFormSection.js b/staff/pere-hernandez/app/isdigram copy 2/home/components/PostFormSection.js deleted file mode 100644 index 96e04fb37..000000000 --- a/staff/pere-hernandez/app/isdigram copy 2/home/components/PostFormSection.js +++ /dev/null @@ -1,13 +0,0 @@ -function PostFormSection () { - Component.call(this, 'section') - - var postForm = new PostForm - - var returnButton = new Button - returnButton.setId('return') - - this.add(postForm, returnButton) -} - -PostFormSection.prototype = Object.create(Collection.prototype) -PostFormSection.prototype.constructor = PostFormSection \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy 2/home/components/Posts.js b/staff/pere-hernandez/app/isdigram copy 2/home/components/Posts.js deleted file mode 100644 index 39040a4db..000000000 --- a/staff/pere-hernandez/app/isdigram copy 2/home/components/Posts.js +++ /dev/null @@ -1,18 +0,0 @@ -function Posts () { - Component.call(this, 'section') - - try { - var posts = logic.retrievePosts() - } catch (error) { - alert(error.message) - } - - posts.forEach(function (post){ - var post1 = new Post(post) - - this.add(post1) - }.bind(this)) -} - -Posts.prototype = Object.create(Component.prototype) -Posts.prototype.constuctor = Posts \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy 2/home/index.css b/staff/pere-hernandez/app/isdigram copy 2/home/index.css deleted file mode 100644 index 4f0902798..000000000 --- a/staff/pere-hernandez/app/isdigram copy 2/home/index.css +++ /dev/null @@ -1,275 +0,0 @@ -header { - position: fixed; - top: 0; - width: 100%; - display: flex; - align-items: end; - justify-content: space-between; - box-sizing: border-box; - background-color: #AFCDEF; -} - -#logo { - margin-left: 1vh; -} - -#logo-img { - max-width: 4vw; -} - -#logo-title{ - font-size: 3vh; - padding: 0; - margin: 0; - text-shadow: 0 0 0; -} - -#logout-button { - height: 50%; - border: 0; - margin-right: 2vw; - margin-bottom: 0.5vh; - background-color: #D9D9D9; -} - -h2{ - margin-top: 10vh; - padding-left: 2vw; -} - -#create-post-img { - display: flex; - justify-content: center; - align-items: center; - width: 8vw; - height: 80%; - border: 0; - border-radius: 50%; - font-size: 4vh; -} - -#create-post-button { - background: none; - border: 0; -} - -#photo-div{ - align-self: center; - display: flex; - align-content: center; - justify-content: center; - background-color:rgb(236, 235, 235); -} - -time { - font-size: 1.2vh; - margin: 0%; - padding-left: 2vw; -} - -p { - margin-bottom: 0; - padding-left: 2vw; -} - -#delete-post-button, #edit-post-button { - margin-top: 1vh ; -} - -#post-form-section { - display: none; - z-index: 2; - background: rgba(0, 0, 0, 0.5); - color: white; - width: 100%; - height: 100%; - position: fixed; - text-align: center; - flex-direction: column; - align-items: center; - justify-content: center; -} - -#postFormButton { - align-self: center; - width: 70vw; - margin-top: 2vh; - height: 4vh; - width: 60vw; - border: 0; - border-radius: 10px; - font-size: 2vh; - background-color: #6CA4E6; - color: aliceblue; - margin-bottom: 2vh; -} - -#return { - align-self: center; - width: 60vw; - height: 4vh; - border: 0; - border-radius: 10px; - font-size: 2vh; - background-color: #D9D9D9; -} - -footer { - position: fixed; - bottom: 0; - width: 100%; - height: 5%; - display: flex; - justify-content: center; - align-items: center; - box-sizing: border-box; - background-color: #AFCDEF; -} - -#chat-icon-button, #home-icon-button{ - width: 16vw; - background-color: white; - border: 0; -} - -#home-icon-button{ - display: none; -} - -ul { - border-top: 1px solid gray; - padding-left: 0; - font-size: 3vh; - background-color: #ebeaea; - list-style-position: inside; -} - -li { - padding: 1.5vh 0 1.5vh 4vw; - border-bottom: gray 1px solid; - margin: 0; -} - -.user-list-online::marker{ - color:limegreen; -} - -.user-list-offline::marker{ - color: red; -} - -#button-div{ - display: flex; - flex-direction: row; -} - -.chat-title { - box-sizing: border-box; - background-color: #AFCDEF; - margin-top: 2vh; - height: 8vh; - display: flex; - align-items: center; - font-size: 3vh; - padding-left: 2vw; - width: 100%; -} - -#chat-section { - height: 100%; - flex-direction: column; - align-items: flex-start; - justify-content: flex-start; -} - -.message-icon{ - max-height: 6vh; -} - -.chat-form{ - flex-direction: row; - align-items: center; - justify-content: space-between; - position: fixed; - bottom: 0; - background-color: #AFCDEF; - padding: 0; - width: 100%; - height: 8vh; -} - -#chat-text-input { - background-color: #f3f2f2; - height: 5vh; - margin: 0; - margin: 0 4vw 0 3vw; - padding: 0 2vw 0 2vw; -} - -.send-message-button { - display: flex; - background-color: #AFCDEF; - border: 0; - justify-content: center; - align-items: center; - height: 8vh; - width: 16vw; - padding: 0; - padding-right: 2vw; -} - -.chat-message-sent, .chat-message-recieved { - background-color: #AFCDEF; - padding: 1.5vw; - margin: 2vh 2vw 0 16vw; - border-radius: 5px; - width: fit-content; - align-self: flex-end; - margin-left: 8vw; -} - -.chat-message-recieved { - background-color: #D9D9D9; - align-self: flex-start; - margin: 2vh 16vw 0 2vw; -} - -.message-section { - width: 100%; -} - -#post-buttons-bar { - box-sizing: border-box; - display: flex; - width: 100%; - justify-content: space-between; - padding: 0 2vw 0 2vw; -} - -.edit-post-form { - display: none; - flex-direction: row; - margin: 2vh 2vw 0 2vw; -} - -.edit-post-input { - width: 100%; - margin: 0 4vw 0 0; - font-size: 4vw; -} - -.edit-post-button { - width: 16vw; - height: 4vh; - background-color: #6CA4E6; - color: white; - border: 0; - margin-right: 1vw; - border-radius: 5px; -} - -.return-from-edit-post-button { - border: 0; - border-radius: 5px; - background-color: #D9D9D9; -} \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy 2/home/index.html b/staff/pere-hernandez/app/isdigram copy 2/home/index.html deleted file mode 100644 index 1d0d8f3f6..000000000 --- a/staff/pere-hernandez/app/isdigram copy 2/home/index.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - Home - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy 2/home/index.js b/staff/pere-hernandez/app/isdigram copy 2/home/index.js deleted file mode 100644 index ab9ee781b..000000000 --- a/staff/pere-hernandez/app/isdigram copy 2/home/index.js +++ /dev/null @@ -1,44 +0,0 @@ -//presentation - -(function () { - if (!logic.checkLoggedInStatus()) { - location.href = '../login' - - return - } - - var home = new Component('main') - - home.assembleTo(document.body) - - var header = new Header - - home.add(header) - - var greeting = new Component('h2') - var greetingText - - try { - var user = logic.retrieveUser() - - greetingText = 'Hello, ' + user.username + '!' - } catch (error) { - alert(error.message) - } - - greeting.setText(greetingText) - - home.add(greeting) - - var menu = new Menu - - home.add(menu) - - var posts = new Posts - - home.add(posts) - - var footer = new Footer - - home.add(footer) -})() \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy 2/logic.js b/staff/pere-hernandez/app/isdigram copy 2/logic.js deleted file mode 100644 index 490ab22dd..000000000 --- a/staff/pere-hernandez/app/isdigram copy 2/logic.js +++ /dev/null @@ -1,330 +0,0 @@ -// business (logic) - -var logic = (function () { - - //constants - - var DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/ - var EMAIL_REGEX = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/ - var PASSWORD_REGEX = /^(?=.*[0-9])(?=.*[A-Za-z])[A-Za-z0-9]+$/ - var URL_REGEX = /^(http|https):\/\// - - - - //helpers - - function validateText(text, explain, checkEmptySpaceInside) { - if (typeof text !== 'string') - throw new TypeError (explain + ' ' + text + ' is not a string') - if (!text.trim().length) - throw new Error (explain + '>' + text + '< is empty or blank') - - if (checkEmptySpaceInside) - if(text.includes(' ')) - throw new Error (explain + ' ' + text + ' has empty spaces') - } - - - function validateDate(date, explain) { - if (!DATE_REGEX.test(date)) - throw new Error(explain + ' '+ date + ' is not a date') - } - - - function validateEmail(email, explain) { - if (!EMAIL_REGEX.test(email)) - throw new Error(explain + ' ' + email + ' is not an email') - } - - - function validatePassword(password, explain) { - if (!PASSWORD_REGEX.test(password)) - throw new Error(explain + ' ' + password + ' is not a valid password') - } - - - function validateUrl(url, explain) { - if (!URL_REGEX.test(url)) - throw new Error(explain + ' ' + url + ' is not an url') - } - - - - //logic - - //USER-related functions - - function registerUser(username, email, password, confirmedPassword){ - //validation - - validateText(username, 'username') - validateEmail(email, 'email') - - //logic - - if (password !== confirmedPassword){ - throw new Error("Passwords don't match") - } - - var user = data.users.findOne(function (user){ - return user.username === username || user.email === email - }) - - if (user) throw new Error ('user already exists') - - var user = { - username: username, - email: email, - password: password, - status: 'offline' - } - - data.users.insertOne(user) - } - - - function loginUser (username, password){ - //validation - - validateText(username, 'username', true) - - - //logic - - var user = data.users.findOne(function (user){ - return user.username === username && user.password === password - }) - - if (!user) throw new Error ('wrong credentials') - - user.status = 'online' - - data.users.updateOne(user) - - sessionStorage.userId = user.id - } - - - function retrieveUser (){ - var user = data.users.findOne(function(user){ - return user.id === sessionStorage.userId - }) - - if (!user) throw new Error('user not found') - - return user - } - - - function retrieveUsers(){ - var users = data.users.getAll() - - var index = users.findIndex(function (user) { - return user.id === sessionStorage.userId - }) - - users.splice(index, 1) - - users.forEach(function (user) { - delete user.email - delete user.password - }) - - users.sort(function (x, y) { - return x.username < y.username ? -1 : 1 - }).sort(function(x, y) { - return x.status > y.status ? -1 : 1 - }) - - return users - } - - - function logoutUser(){ - var user = data.users.findOne(function (user) { - return user.id === sessionStorage.userId - }) - - if (!user){ - throw new Error('wrong credentials') - } - - user.status = 'offline' - - data.users.updateOne(user) - - delete sessionStorage.userId - } - - - function getLoggedInUserId () { - return sessionStorage.userId - } - - function checkLoggedInStatus(){ - return !!sessionStorage.userId - } - - - - //POST-related functions - - function createPost (photo, comment){ - //validation - - validateText(comment, 'comment') - - //logic - - var post = { - author: sessionStorage.userId, - photo: photo, - comment: comment, - date: new Date().toLocaleDateString('en-CA') - } - - data.posts.insertOne(post) - } - - - function retrievePosts(){ - var posts = data.posts.getAll() - - posts.forEach(function (post) { - var user = data.users.findOne(function (user) { - return user.id === post.author - }) - - post.author = {id: user.id, username: user.username} - }) - return posts.reverse() - } - - - function deletePost (postId) { - //validation - - validateText(postId, 'PostId', true) - - //logic - var post = data.posts.findOne(function (post) { - return post.id === postId - }) - - if (!post) throw new Error ('post not found') - - if (post.author !== sessionStorage.userId) throw new Error ("can't delete somebody else's post") - - data.posts.deleteOne(function (post) { - return post.id === postId - }) - } - - - function updatePost (postId, text){ - //validation - - validateText(postId, 'PostId', true) - validateText(text, 'text') - - //logic - var post = data.posts.findOne(function (post){ - return post.id === postId - }) - - if (!post) - throw new Error ('post not found') - - if (post.author !== sessionStorage.userId) - throw new Error ('post does not belong to user') - - post.comment = text - - data.posts.updateOne(post) - } - - - - //CHAT-related functions - - function createChat(user){ - var chat = { - users: [sessionStorage.userId, user.id], - messages: [], - date: new Date().toLocaleDateString('en-CA') - } - - data.chats.insertOne(chat) - - return chat - } - - - function addMessageToChat (message, chatId){ - var chat = data.chats.findOne(function (chat){ - return chatId === chat.id - }) - - chat.messages.push(message) - - data.chats.updateOne(chat) - } - - - function retrieveMessagesWith (userID){ - var chat = data.chats.findOne(function (chat) { - return chat.users.includes(userID) && chat.users.includes(sessionStorage.userId) - }) - - if (chat) - return chat.messages - else - return [] - } - - - function retrieveChatWith (userID){ - var chat = data.chats.findOne(function(chat){ - return chat.users.includes(userID) && chat.users.includes(sessionStorage.userId) - }) - - if (!chat) throw new Error('user not found') - - return chat - } - - - - //MESSAGE-related functions - - function createMessage(message){ - var message = { - text: message, - author: sessionStorage.userId, - time: new Date().toLocaleDateString('en-CA') - } - return message - } - - return { - registerUser: registerUser, - loginUser: loginUser, - retrieveUser: retrieveUser, - retrieveUsers, retrieveUsers, - logoutUser: logoutUser, - getLoggedInUserId: getLoggedInUserId, - checkLoggedInStatus: checkLoggedInStatus, - - createPost: createPost, - retrievePosts: retrievePosts, - deletePost: deletePost, - updatePost: updatePost, - - createChat: createChat, - addMessageToChat: addMessageToChat, - retrieveMessagesWith: retrieveMessagesWith, - retrieveChatWith: retrieveChatWith, - - createMessage: createMessage - } -}) () \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy 2/login/index.css b/staff/pere-hernandez/app/isdigram copy 2/login/index.css deleted file mode 100644 index 6ff44c5c2..000000000 --- a/staff/pere-hernandez/app/isdigram copy 2/login/index.css +++ /dev/null @@ -1,70 +0,0 @@ -body { - margin: 0; - display: flex; - justify-content: center; - align-items: center; - box-sizing: border-box; -} - -h1 { - margin: 0; -} - -#title { - margin: 0; -} - -#terms { - margin: 0; - margin-right: 2vw; - max-height: 2vh; - max-width: 2vh; -} - -#terms-text { - font-size: 1.5vh; -} - -#login-button{ - width: 70vw; - margin-top: 2vh; - height: 8vh; - border: 0; - border-radius: 10px; - font-size: 3vh; - background-color: #6CA4E6; - color: aliceblue; -} - -#register-button{ - width: 70vw; - margin-top: 2vh; - height: 8vh; - border: 0; - background-color: #D9D9D9; - border-radius: 10px; - font-size: 3vh; -} - -#termsDiv{ - width: 100%; - align-self: center; - display: flex; - justify-content: center; - align-items: center; - margin-bottom: 3vh; - margin-top: 3vh; -} - -h2{ - margin-top: 0; - font-size: 2vh; - align-self: center; - justify-self: center; -} - -#title { - display: flex; - flex-direction: column; - margin-bottom: 8vh; -} \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy 2/login/index.html b/staff/pere-hernandez/app/isdigram copy 2/login/index.html deleted file mode 100644 index 4586aa198..000000000 --- a/staff/pere-hernandez/app/isdigram copy 2/login/index.html +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - Login - - - - -
- -

Isdigram.

-

Ad astra per aspera

-
- -
- - - - - -
- - - - - - - - - - - - - \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy 2/login/index.js b/staff/pere-hernandez/app/isdigram copy 2/login/index.js deleted file mode 100644 index 4eb21a802..000000000 --- a/staff/pere-hernandez/app/isdigram copy 2/login/index.js +++ /dev/null @@ -1,29 +0,0 @@ -//presentation - -(function () { - if (logic.checkLoggedInStatus()){ - location.href = '../home' - - return - } - - - var form = document.querySelector('form') - - form.addEventListener('submit', function (event){ - event.preventDefault() - - var usernameImput = document.getElementById('username') - var username = usernameImput.value - - var passwordInput = document.getElementById('password') - var password = passwordInput.value - - try { - logic.loginUser(username, password) - location.href = '../home' - } catch (error) { - alert(error.message) - } - }) -})() \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy 2/logo.png b/staff/pere-hernandez/app/isdigram copy 2/logo.png deleted file mode 100644 index dca6a2afa..000000000 Binary files a/staff/pere-hernandez/app/isdigram copy 2/logo.png and /dev/null differ diff --git a/staff/pere-hernandez/app/isdigram copy 2/mail.png b/staff/pere-hernandez/app/isdigram copy 2/mail.png deleted file mode 100644 index b6c713850..000000000 Binary files a/staff/pere-hernandez/app/isdigram copy 2/mail.png and /dev/null differ diff --git a/staff/pere-hernandez/app/isdigram copy 2/photo.png b/staff/pere-hernandez/app/isdigram copy 2/photo.png deleted file mode 100644 index 19a0367f7..000000000 Binary files a/staff/pere-hernandez/app/isdigram copy 2/photo.png and /dev/null differ diff --git a/staff/pere-hernandez/app/isdigram copy 2/register/index.css b/staff/pere-hernandez/app/isdigram copy 2/register/index.css deleted file mode 100644 index 77c525953..000000000 --- a/staff/pere-hernandez/app/isdigram copy 2/register/index.css +++ /dev/null @@ -1,63 +0,0 @@ -body { - margin: 0; - display: flex; - justify-content: center; - align-items: center; - box-sizing: border-box; -} - -#interactive-content { - width: 70vw; - margin: 0; - margin-top: 4vh; -} - -h1 { - margin: 0; -} - -#title { - margin: 0; -} - -#terms { - margin: 0; - margin-right: 2vw; - max-height: 2vh; - max-width: 2vh; -} - -#terms-text { - font-size: 1.5vh; -} - -#login-button{ - width: 70vw; - margin-top: 2vh; - height: 8vh; - border: 0; - background-color: #D9D9D9; - border-radius: 10px; - font-size: 3vh; -} - -#register-button{ - width: 70vw; - margin-top: 2vh; - height: 8vh; - border: 0; - background-color: #6CA4E6; - color: aliceblue; - border-radius: 10px; - font-size: 3vh; -} - -#termsDiv{ - width: 100%; - align-self: center; - display: flex; - justify-content: center; - align-items: center; - margin-bottom: 3vh; - margin-top: 3vh; -} \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy 2/register/index.html b/staff/pere-hernandez/app/isdigram copy 2/register/index.html deleted file mode 100644 index 49b8cc8ca..000000000 --- a/staff/pere-hernandez/app/isdigram copy 2/register/index.html +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - Register - - - - -
- -

Isdigram.

-
- -
-
- - - - - - - - - - - - -
- - -
- - -
- - -
- - - - - - - - - - - \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy 2/register/index.js b/staff/pere-hernandez/app/isdigram copy 2/register/index.js deleted file mode 100644 index e5abcd019..000000000 --- a/staff/pere-hernandez/app/isdigram copy 2/register/index.js +++ /dev/null @@ -1,32 +0,0 @@ -//presentation - -(function () { - var form = document.querySelector('form') - var loginLink = document.querySelector('a') - - form.addEventListener('submit', function (event){ - event.preventDefault() - - var usernameImput = document.getElementById('username') - var username = usernameImput.value - - var emailImput = document.getElementById('email') - var email = emailImput.value - - var passwordImput = document.getElementById('password') - var password = passwordImput.value - - var confimrPasswordImput = document.getElementById('confirm') - var confirmedPassword = confimrPasswordImput.value - - try { - logic.registerUser(username, email, password, confirmedPassword) - - form.reset() - - location.href = '../login' - } catch (error) { - alert(error.message) - } - }) -})() diff --git a/staff/pere-hernandez/app/isdigram copy 2/styles.css b/staff/pere-hernandez/app/isdigram copy 2/styles.css deleted file mode 100644 index 469882d9d..000000000 --- a/staff/pere-hernandez/app/isdigram copy 2/styles.css +++ /dev/null @@ -1,93 +0,0 @@ -body, form, #interactive-content { - display: flex; - flex-direction: column; - margin: 0; - font-size: 2vh; - font-family: 'Open-sans', sans-serif; - overflow: scroll; -} - -body { - height: 100vh; -} - -h1{ - font-size: 7vh; - margin-top: 0; -} - -input { - background-color: #AFCDEF; - border: none; - width: 100%; - height: 4vh; - margin-bottom: 2vh; - box-sizing: border-box; -} - -#title { - margin-top: 2vh; -} - -#title-logo { - margin-bottom: 0; - max-width: 5vh; -} - -#newPostForm { - width: 80%; -} - -#return { - margin-bottom: 7vh; - max-width: 20vw; -} - - -#header-title{ - font-size: 3vh; - padding: 0; - margin: 0; - text-shadow: 0 0 0; -} - -#header-img { - max-width: 4vw; -} - -h2 { - font-size: 7vw; -} - -section { - display: flex; - justify-content: center; - flex-direction: column; -} - -article { - margin-bottom: 5vh; -} - -img { - max-width: 100%; -} - -#post-list-section { - display: flex; - flex-direction: column; -} - -#post-form-section { - display: none; -} - -.delete-post-button { - display: flex; - justify-self: flex-end; - margin-top: 2vh; -} - -h3{ - padding-left: 2vw; -} \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy 2/vendor/matcha.js b/staff/pere-hernandez/app/isdigram copy 2/vendor/matcha.js deleted file mode 100644 index dbecc146f..000000000 --- a/staff/pere-hernandez/app/isdigram copy 2/vendor/matcha.js +++ /dev/null @@ -1,73 +0,0 @@ -console.log('MATCHA 🍵 v0.1') - -var matcha = {} - -var logs = [] - -function describe(title, callback) { - logs[logs.length] = title - console.log(title) - - callback() -} - -function it(title, callback) { - var log = '* ' + title - - logs[logs.length] = log - console.log(log) - - callback() -} - -function expect(value) { - return { - toBe: function (expected) { - var matches = value === expected - - if (!matches) { - var log = '❌ ' + value + ' to be ' + expected - - logs[logs.length] = log - console.error(log) - - return false - } - - var log = '✅ ' + value + ' to be ' + expected - - logs[logs.length] = log - console.info(log) - - return true - }, - - toBeInstanceOf: function (expected) { - var matches = value instanceof expected - - if (!matches) { - var log = '❌ ' + value + ' to be instance of ' + expected.name - - logs[logs.length] = log - console.error(log) - - return false - } - - var log = '✅ ' + value + ' to be instance of ' + expected.name - - logs[logs.length] = log - console.info(log) - - return true - } - } -} - -matcha.logs = logs -matcha.describe = describe -matcha.it = it -matcha.expect = expect - -if (typeof module !== 'undefined') - module.exports = matcha \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy 3/home/components/Chat.mjs b/staff/pere-hernandez/app/isdigram copy 3/home/components/Chat.mjs deleted file mode 100644 index f6f7ea593..000000000 --- a/staff/pere-hernandez/app/isdigram copy 3/home/components/Chat.mjs +++ /dev/null @@ -1,54 +0,0 @@ -import Component from "../../core/Component.mjs" - -import UserList from "./UserList.mjs" -import messageList from "./MessageList.mjs" -import ChatForm from "./ChatForm.mjs" -import MessageList from "./MessageList.mjs" - -class Chat extends Component { - constructor(){ - super('section') - - const userList = new UserList - userList.setId('user-list-section') - - this._messageList - let chatForm - - userList.onUserClick(user => { - this.remove(userList) - if (!this._messageList) { - let chatSection = new Component('div') - - let chatTitle = new Component('div') - chatTitle.setClass('chat-title') - chatTitle.setText(user.username) - - this._messageList = new messageList(user) - chatForm = new ChatForm(user) - - chatForm.onSendMessage(() => this._messageList.refresh()) - - chatSection.add(chatTitle, this._messageList, chatForm) - - this.add(chatSection) - } else { - this._messageList.stopAutoRefresh() - - const oldMessageList = this._messageList - const oldChatForm = chatForm - - this._messageList = new MessageList(user) - chatForm = new ChatForm(user) - - chatForm.onSendMessage(() => this._messageList.refresh()) - - this.replace(oldMessageList, this._messageList) - this.replace(oldChatForm, chatForm) - } - }) - this.add(userList) - } -} - -export default Chat \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy 3/home/components/ChatForm.mjs b/staff/pere-hernandez/app/isdigram copy 3/home/components/ChatForm.mjs deleted file mode 100644 index 850489431..000000000 --- a/staff/pere-hernandez/app/isdigram copy 3/home/components/ChatForm.mjs +++ /dev/null @@ -1,69 +0,0 @@ -import Form from "../../core/Form.mjs" - -import Input from "../../core/Input.mjs"; -import Button from "../../core/Button.mjs"; -import Image from "../../core/Image.mjs"; - -import logic from "../../logic.mjs"; - -class ChatForm extends Form { - constructor(user){ - super() - - this.setClass('chat-form') - - const input = new Input - input.setId('chat-text-input') - input.setType('text') - - const sendMessageButton = new Button - sendMessageButton.setClass('send-message-button') - sendMessageButton.setType('submit') - - const sendMessageImg = new Image - sendMessageImg.setSource('../mail.png') - sendMessageImg.setClass('message-icon') - - sendMessageButton.add(sendMessageImg) - - this.onSubmit(event => { - event.preventDefault() - - let chatWith = logic.retrieveChatWith(user.id) - - if (!chatWith) - chatWith = logic.createChat(user) - - const messageValue = input.getValue() - - const newMessage = logic.createMessage(messageValue) - - try { - logic.addMessageToChat(newMessage, chatWith.id) - - this.reset() - - this._onSendMessageCallback() - } catch (error) { - alert(error.message) - } - }) - - this.add(input, sendMessageButton) - - this.onSendMessageCallback = null - } - - onSendMessage(callback){ - //validation - - if (typeof callback !== 'function') - throw new TypeError('callback is not a Function') - - //logic - - this._onSendMessageCallback = callback - } -} - -export default ChatForm \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy 3/home/components/CreatePost.mjs b/staff/pere-hernandez/app/isdigram copy 3/home/components/CreatePost.mjs deleted file mode 100644 index dd5729992..000000000 --- a/staff/pere-hernandez/app/isdigram copy 3/home/components/CreatePost.mjs +++ /dev/null @@ -1,103 +0,0 @@ -import Component from "../../core/Component.mjs"; - -import Form from "../../core/Form.mjs" -import Label from "../../core/Label.mjs" -import Input from "../../core/Input.mjs" -import Button from "../../core/Button.mjs"; - -import logic from "../../logic.mjs"; - -class CreatePost extends Component { - constructor(){ - super('section') - - this.setClass('post-form-section') - - const form = new Form - form.setId('new-post-form') - - const imageLabel = new Label - imageLabel.setFor('image') - imageLabel.setText('Paste your photo link here') - - const imageInput = new Input - imageInput.setId('image') - imageInput.setType('text') - - const commentLabel = new Label - commentLabel.setFor('label') - commentLabel.setText('Write a comment') - - const commentInput = new Input - commentInput.setId('comment') - commentInput.setType('text') - - const submitButton = new Button - submitButton.setText('Post') - submitButton.setId('postFormButton') - submitButton.setType('submit') - - form.add(imageLabel, imageInput, commentLabel, commentInput, submitButton) - - const returnButton = new Button - returnButton.setText('Return') - returnButton.setId('return') - - this._returnButton = returnButton - - this.add(form, returnButton) - - form.onSubmit(event => { - event.preventDefault() - - const image = imageInput.getValue() - const comment = commentInput.getValue() - - try{ - logic.createPost(image, comment) - - this._onPostCreatedCallback() - } catch (error) { - alert(error.message) - } - }) - - this._onPostCreatedCallback = null - - CreatePost.active = true - } - - static active = false - - onReturnClick(callback){ - //validation - - if(typeof callback !== 'function') - throw new TypeError ('callback is not a function') - - //logic - - this._returnButton.onClick(() => { - CreatePost.active = false - - callback() - }) - } - - onPostCreated(callback) { - //validation - - if(typeof callback !== 'function') - throw new TypeError ('callback is not a function') - - //logic - - this._onPostCreatedCallback = () => { - CreatePost.active = false - - callback() - } - } -} - -export default CreatePost diff --git a/staff/pere-hernandez/app/isdigram copy 3/home/components/Footer.mjs b/staff/pere-hernandez/app/isdigram copy 3/home/components/Footer.mjs deleted file mode 100644 index 9746098f7..000000000 --- a/staff/pere-hernandez/app/isdigram copy 3/home/components/Footer.mjs +++ /dev/null @@ -1,41 +0,0 @@ - - -import Button from "../../core/Button.mjs" -import Component from "../../core/Component.mjs" -import Image from "../../core/Image.mjs" - -class Footer extends Component{ - constructor(){ - super('footer') - - const createPostButton = new Button - createPostButton.setId('create-post-button') - - const createPostImage = new Image - createPostImage.setSource('../add-circle-fill-system.256x256.png') - createPostImage.setId('create-post-img') - - createPostButton.add(createPostImage) - - this.add(createPostButton) - - this._createPostButton = createPostButton - } - - onCreatePostClick(callback) { - //validation - - if (typeof callback !== 'function') - alert('callback is not a function') - - //logic - - this._createPostButton.onClick(callback) - } - - onCreatePostClick(callback){ - this._createPostButton.onClick(callback) - } -} - -export default Footer \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy 3/home/components/Header.mjs b/staff/pere-hernandez/app/isdigram copy 3/home/components/Header.mjs deleted file mode 100644 index fabca9d35..000000000 --- a/staff/pere-hernandez/app/isdigram copy 3/home/components/Header.mjs +++ /dev/null @@ -1,29 +0,0 @@ -import Component from "../../core/Component.mjs" - -import Logo from "../../core/Logo.mjs" -import Button from "../../core/Button.mjs" - -import logic from "../../logic.mjs" - -class Header extends Component { - constructor(){ - super('header') - - const logo = new Logo - logo.setId('logo') - - const logoutButton = new Button - logoutButton.setText('Logout') - logoutButton.setId('logout-button') - - logoutButton.onClick(() => { - logic.logoutUser() - - location.href = '../login' - }) - - this.add(logo, logoutButton) - } -} - -export default Header \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy 3/home/components/Menu.mjs b/staff/pere-hernandez/app/isdigram copy 3/home/components/Menu.mjs deleted file mode 100644 index a3858aa42..000000000 --- a/staff/pere-hernandez/app/isdigram copy 3/home/components/Menu.mjs +++ /dev/null @@ -1,64 +0,0 @@ -import Component from "../../core/Component.mjs" - -import Button from "../../core/Button.mjs" -import Image from "../../core/Image.mjs" - -class Menu extends Component { - constructor(){ - super('nav') - - const homeButton = new Button - homeButton.setId('home-icon-button') - - this._homeButton = homeButton - - const homeImage = new Image - homeImage.setSource('../home.png') - - homeButton.add(homeImage) - - const chatButton = new Button - chatButton.setId('chat-icon-button') - - this._chatbutton = chatButton - - const chatImage = new Image - chatImage.setSource('../chat.svg') - - chatButton.add(chatImage) - - this.add(chatButton) - } - - onChatClick(callback){ - //validation - - if(typeof callback !== 'function') - throw new TypeError('callback is not a function') - - //logic - - this._chatbutton.onClick(() => { - this.replace(this._chatbutton, this._homeButton) - - callback() - }) - } - - onHomeClick(callback) { - //validation - - if(typeof callback !== 'function') - throw new TypeError('callback is not a function') - - //logic - - this._homeButton.onClick(() => { - this.replace(this._homeButton, this._chatbutton) - - callback() - }) - } -} - -export default Menu \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy 3/home/components/MessageList.mjs b/staff/pere-hernandez/app/isdigram copy 3/home/components/MessageList.mjs deleted file mode 100644 index 8fd09ad6e..000000000 --- a/staff/pere-hernandez/app/isdigram copy 3/home/components/MessageList.mjs +++ /dev/null @@ -1,46 +0,0 @@ -import Component from "../../core/Component.mjs"; - -import logic from "../../logic.mjs"; - -class MessageList extends Component { - constructor(user){ - super('ul') - - this._userId = user.id - - this.setClass('message-section') - - this.refresh() - - this._refreshIntervalId = setInterval(() => - this.refresh(), 1000) - } - - refresh() { - this.removeAll() - - try{ - const messages = logic.retrieveMessagesWith(this._userId) - - messages.forEach(message => { - const messageP = new Component ('li') - messageP.setText(message.text) - - if (message.author === logic.getLoggedInUserId()) - messageP.setClass('chat-message-sent') - else - messageP.setClass('chat-message-recieved') - - this.add(messageP) - }) - } catch (error) { - alert(error.message) - } - } - - stopAutoRefresh() { - clearInterval(this._refreshIntervalId) - } - } - -export default MessageList diff --git a/staff/pere-hernandez/app/isdigram copy 3/home/components/Post.mjs b/staff/pere-hernandez/app/isdigram copy 3/home/components/Post.mjs deleted file mode 100644 index 8a74f1662..000000000 --- a/staff/pere-hernandez/app/isdigram copy 3/home/components/Post.mjs +++ /dev/null @@ -1,72 +0,0 @@ -import Component from "../../core/Component.mjs" - -import logic from "../../logic.mjs" - -import Image from "../../core/Image.mjs" -import Button from "../../core/Button.mjs" - -class Post extends Component { - constructor(post){ - super('article') - - const author = new Component('h3') - author.setText(post.author.username) - - const photo = new Image - photo.setSource(post.photo) - - const photoDiv = new Component('div') - photoDiv.setId('photo-div') - - photoDiv.add(photo) - - const comment = new Component('p') - comment.setText(post.comment) - - const date = new Component('time') - date.setText(post.date) - - this.add(author, photoDiv, comment, date) - - if (post.author.id === logic.getLoggedInUserId()){ - const postButtonsBar = new Component ('div') - postButtonsBar.setId('post-buttons-bar') - - const deleteButton = new Button - deleteButton.setClass('delete-post-button') - deleteButton.setText('Delete') - - deleteButton.onClick(() => { - if(confirm('Do you want to delete this post?')) - try { - logic.deletePost(post.id) - - this._onDeleteCallback() - } catch (error) { - alert(error.message) - } - }) - - const updateButton = new Button - updateButton.setClass('update-post-button') - updateButton.setText('Edit') - - postButtonsBar.add(deleteButton, updateButton) - - this.add(postButtonsBar) - } - - this._onDeleteCallback = null - } - - onDeleted(callback){ - //validation - - if(typeof callback !== 'function') - throw new TypeError('callback is not a Function') - - this._onDeleteCallback = callback - } -} - -export default Post \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy 3/home/components/Posts.mjs b/staff/pere-hernandez/app/isdigram copy 3/home/components/Posts.mjs deleted file mode 100644 index 6c9dc2890..000000000 --- a/staff/pere-hernandez/app/isdigram copy 3/home/components/Posts.mjs +++ /dev/null @@ -1,35 +0,0 @@ -import Component from "../../core/Component.mjs" - -import logic from "../../logic.mjs" - -import Post from "./Post.mjs" - -class Posts extends Component { - constructor(){ - super('section') - - this.refresh() - } - - refresh(){ - let posts - try { - posts = logic.retrievePosts() - - this.removeAll() - } catch (error) { - alert(error.message) - } - - posts.forEach((post) => { - const post1 = new Post(post) - this.add(post1) - - post1.onDeleted(() => { - this.refresh() - }) - }) - } -} - -export default Posts \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy 3/home/components/UserList.mjs b/staff/pere-hernandez/app/isdigram copy 3/home/components/UserList.mjs deleted file mode 100644 index 19cfd5855..000000000 --- a/staff/pere-hernandez/app/isdigram copy 3/home/components/UserList.mjs +++ /dev/null @@ -1,44 +0,0 @@ -import Component from "../../core/Component.mjs" - -import logic from "../../logic.mjs" - -class UserList extends Component { - constructor() { - super('ul') - - try { - const users = logic.retrieveUsers() - - users.forEach(user => { - const userLi = new Component ('li') - userLi.setText(user.username) - - if (user.status === 'online') - userLi.setClass('user-list-online') - else - userLi.setClass('user-list-offline') - - userLi.onClick(() => this._onUserClickCallback(user)) - - this.add(userLi) - }) - } catch (error) { - alert(error.message) - } - - this._onUserClickCallback = null - } - - onUserClick(callback) { - //validation - - if (typeof callback !== 'function') - throw new TypeError('callback is not a Function') - - //logic - - this._onUserClickCallback = callback - } -} - -export default UserList \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy/README.md b/staff/pere-hernandez/app/isdigram copy/README.md deleted file mode 100644 index 0cbe0721d..000000000 --- a/staff/pere-hernandez/app/isdigram copy/README.md +++ /dev/null @@ -1,28 +0,0 @@ -# ISDIGram - -## Functional Description - -### Functionalities - -- Crate a post - - take picture with camera - - upload picture from phone - - apply filter to picture - - Tag a user -- View other people's posts -- Send messages -- Follow user -- Search user -- Search post (by hashtag) -- Toggle like a post -- Toggle save a post -- Comment a post -- Video-call user -- Live video streaming -- Publsh a story - -### UI Design - -#### Layout - -#### Prototype \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy/add-circle-fill-system.256x256.png b/staff/pere-hernandez/app/isdigram copy/add-circle-fill-system.256x256.png deleted file mode 100644 index 0de6a034c..000000000 Binary files a/staff/pere-hernandez/app/isdigram copy/add-circle-fill-system.256x256.png and /dev/null differ diff --git a/staff/pere-hernandez/app/isdigram copy/chat-logo.png b/staff/pere-hernandez/app/isdigram copy/chat-logo.png deleted file mode 100644 index ad1de9de9..000000000 Binary files a/staff/pere-hernandez/app/isdigram copy/chat-logo.png and /dev/null differ diff --git a/staff/pere-hernandez/app/isdigram copy/chat.svg b/staff/pere-hernandez/app/isdigram copy/chat.svg deleted file mode 100644 index f7cdb7bbe..000000000 --- a/staff/pere-hernandez/app/isdigram copy/chat.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy/data/Collection.js b/staff/pere-hernandez/app/isdigram copy/data/Collection.js deleted file mode 100644 index 89778adfc..000000000 --- a/staff/pere-hernandez/app/isdigram copy/data/Collection.js +++ /dev/null @@ -1,130 +0,0 @@ -function Collection(name){ - this.name = name -} - - - -//helpers - -Collection.prototype._generateId = function() { - return (+((parseInt(Math.random() * 10 ** 17)).toString())).toString(36) -} - -Collection.prototype._loadDocuments = function () { - var documentsJSON = localStorage[this.name] - - var documents = JSON.parse(documentsJSON || '[]') - - return documents -} - -Collection.prototype._saveDocuments = function (documents) { - //validation - - if (!(documents instanceof Array)) - throw new TypeError ('documents is not an Array') - - documents.forEach(function (document){ - if(!(document instanceof Object)) - throw new TypeError('some elements in documents are not a document') - }) - - //logic - var documentsJSON = JSON.stringify(documents) - - localStorage[this.name] = documentsJSON -} - -Collection.prototype._backup = function (){ - localStorage[this.name + '_backup'] = localStorage[this.name] -} - -Collection.prototype._restore = function (){ - localStorage[this.name] = localStorage[this.name + '_backup'] -} - - - -// CRUD - -Collection.prototype.findOne = function (callback) { - //validation - - if (!(callback instanceof Function)) - throw new TypeError ('callback is not a Function') - - //logic - var documents = this._loadDocuments() - - var document = documents.find(callback) - - return document -} - -Collection.prototype.insertOne = function (document) { - //validation - - if (!(document instanceof Object)) - throw new TypeError ('document is not an Object') - - //logic - var documents = this._loadDocuments() - - document.id = this._generateId() - - documents.push(document) - - this._saveDocuments(documents) -} - -Collection.prototype.updateOne = function (document) { - //validation - - if (!(document instanceof Object)) - throw new TypeError('document is not an Object') - if (typeof document.id !== 'string') - throw new TypeError('id must be a string') - - //logic - var documents = this._loadDocuments() - - var index = documents.findIndex(function (document2) { - return document2.id === document.id - }) - - if (index > -1){ - documents.splice(index, 1, document) - - this._saveDocuments(documents) - } -} - -Collection.prototype.deleteOne = function (callback){ - //validation - - if (!(callback instanceof Function)) - throw new TypeError ('callback is not a Function') - - //logic - var documents = this._loadDocuments() - - var index = documents.findIndex(callback) - - if (index > -1){ - documents.splice(index, 1) - - this._saveDocuments(documents) - } -} - -Collection.prototype.getAll = function (){ - var documents = this._loadDocuments() - - return documents -} - -Collection.prototype.printAll = function () { - var documents = this._loadDocuments() - - console.table(documents) -} \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy/data/Collection.spec.html b/staff/pere-hernandez/app/isdigram copy/data/Collection.spec.html deleted file mode 100644 index b95b90519..000000000 --- a/staff/pere-hernandez/app/isdigram copy/data/Collection.spec.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - Collection spec - - - -

Collection spec

- - - - - - - \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy/data/Collection.spec.js b/staff/pere-hernandez/app/isdigram copy/data/Collection.spec.js deleted file mode 100644 index 38e1c0678..000000000 --- a/staff/pere-hernandez/app/isdigram copy/data/Collection.spec.js +++ /dev/null @@ -1,590 +0,0 @@ -describe('Collection', function(){ - describe('constructor', function(){ - it('creates a collection', function(){ - var cars = new Collection('cars') - - expect(cars).toBeInstanceOf(Collection) - }) - }) - - - - - describe('> helpers', function(){ - describe('_generateId', function(){ - it('generates an id', function(){ - var cars = new Collection('cars') - - var id1 = cars._generateId() - - expect(typeof id1).toBe('string') - - var id2 = cars._generateId() - - expect(typeof id2).toBe('string') - - expect(id1 === id2).toBe(false) - - delete (localStorage.cars) - }) - }) - - - - describe('_loadDocuments', function(){ - it('loads empty array on a new collection', function(){ - delete (localStorage.cars) - - var cars = new Collection('cars') - - var documents = cars._loadDocuments() - - expect(documents).toBeInstanceOf(Array) - expect(documents.length).toBe(0) - }) - - it('loads data on non-empty collection', function(){ - delete (localStorage.cars) - - localStorage.cars = '[{"brand": "Renault", "model": "Megane"}, {"brand": "Peugeot", "model": "208"}]' - - var cars = new Collection('cars') - - var documents = cars._loadDocuments() - - expect(documents).toBeInstanceOf(Array) - expect(documents.length).toBe(2) - - expect(documents[0]).toBeInstanceOf(Object) - expect(documents[0].brand).toBe('Renault') - expect(documents[0].model).toBe('Megane') - - expect(documents[1]).toBeInstanceOf(Object) - expect(documents[1].brand).toBe('Peugeot') - expect(documents[1].model).toBe('208') - - delete (localStorage.cars) - }) - }) - - - - describe('_saveDocuments', function(){ - it('should save a collection', function(){ - delete (localStorage.cars) - - var documents = [{"brand": "Renault", "model": "Megane"}, {"brand": "Peugeot", "model": "208"}] - - var cars = new Collection ('cars') - - cars._saveDocuments(documents) - - expect(!!localStorage.cars).toBe(true) - expect(typeof localStorage.cars).toBe('string') - - var documentsString = '[{"brand":"Renault","model":"Megane"},{"brand":"Peugeot","model":"208"}]' - - expect(localStorage.cars).toBe(documentsString) - - delete (localStorage.cars) - }) - - it('should fail on non-Array documents', function(){ - delete (localStorage.cars) - - var documents = 'I am not an Array' - - var cars = new Collection('cars') - - var errorThrown - - try { - cars._saveDocuments(documents) - } catch (error) { - errorThrown = error - } - - expect(!!localStorage.cars).toBe(false) - - expect(errorThrown).toBeInstanceOf(TypeError) - expect(errorThrown.message).toBe('documents is not an Array') - - delete (localStorage.cars) - }) - - it('should fail on documents being an Array of non-documents', function (){ - delete (localStorage.cars) - - var documents = ['I am not an Object', 123] - - var cars = new Collection('cars') - - var errorThrown - - try { - cars._saveDocuments(documents) - } catch (error) { - errorThrown = error - } - - expect(!!localStorage.cars).toBe(false) - - expect(errorThrown).toBeInstanceOf(TypeError) - expect(errorThrown.message).toBe('some elements in documents are not a document') - - delete (localStorage.cars) - }) - }) - - - - describe('_backup', function(){ - it('should create a backup copy', function(){ - delete (localStorage.cars) - delete (localStorage.cars_backup) - - localStorage.cars = '[{"brand":"Renault","model":"Megane"},{"brand":"Peugeot","model":"208"}]' - - var cars = new Collection('cars') - - cars._backup() - - expect(!!localStorage.cars_backup).toBe(true) - - expect(localStorage.cars_backup).toBe(localStorage.cars) - - delete (localStorage.cars) - delete (localStorage.cars_backup) - }) - }) - - - - describe('_restore', function(){ - it('should restore a collection', function(){ - delete (localStorage.cars) - delete (localStorage.cars_backup) - - localStorage.cars_backup = '[{"brand":"Renault","model":"Megane"},{"brand":"Peugeot","model":"208"}]' - - var cars = new Collection('cars') - - cars._restore() - - expect(!!localStorage.cars).toBe(true) - - expect(localStorage.cars).toBe(localStorage.cars_backup) - - delete (localStorage.cars) - delete (localStorage.cars_backup) - }) - }) - }) - - - - - describe('> CRUD', function(){ - describe('findOne', function(){ - it('should find an existing document', function(){ - delete (localStorage.cars) - delete (localStorage.cars_backup) - - localStorage.cars = '[{"brand":"Renault","model":"Megane"},{"brand":"Peugeot","model":"208"}]' - - var cars = new Collection('cars') - - var car = cars.findOne(function (car){ - return car.brand === 'Renault' - }) - - expect(!!car).toBe(true) - expect(car).toBeInstanceOf(Object) - expect(car.brand).toBe('Renault') - expect(car.model).toBe('Megane') - - delete (localStorage.cars) - delete (localStorage.cars_backup) - }) - - it('should return undefined on no matches', function(){ - delete (localStorage.cars) - delete (localStorage.cars_backup) - - localStorage.cars = '[{"brand":"Renault","model":"Megane"},{"brand":"Peugeot","model":"208"}]' - - var cars = new Collection('cars') - - var car = cars.findOne(function (car){ - return car.brand === 'Fiat' - }) - - expect(!!car).toBe(false) - expect(car).toBe(undefined) - - delete (localStorage.cars) - delete (localStorage.cars_backup) - }) - - it('should fail on callback not a function', function(){ - delete (localStorage.cars) - - localStorage.cars = '[{"brand":"Renault","model":"Megane"},{"brand":"Peugeot","model":"208"}]' - - var cars = new Collection('cars') - - var errorThrown - - try { - var car = cars.findOne('I am not a Function') - } catch (error) { - errorThrown = error - } - - expect(!!car).toBe(false) - - expect(errorThrown).toBeInstanceOf(TypeError) - expect(errorThrown.message).toBe('callback is not a Function') - - delete (localStorage.cars) - }) - }) - - - - describe('insertOne', function(){ - it('should insert a document in a collection', function(){ - delete (localStorage.cars) - - localStorage.cars = '[{"brand":"Renault","model":"Megane"},{"brand":"Peugeot","model":"208"}]' - - var cars = new Collection('cars') - - var car = {brand: 'Toyota', model: 'Yaris'} - - cars.insertOne(car) - - parsedCars = JSON.parse(localStorage.cars) - - expect(!!localStorage.cars).toBe(true) - expect(parsedCars.length).toBe(3) - - expect(parsedCars[0].brand).toBe('Renault') - expect(parsedCars[0].model).toBe('Megane') - - expect(parsedCars[1].brand).toBe('Peugeot') - expect(parsedCars[1].model).toBe('208') - - expect(parsedCars[2].brand).toBe('Toyota') - expect(parsedCars[2].model).toBe('Yaris') - - delete (localStorage.cars) - }) - - - it('should not work on non-Object document', function(){ - delete (localStorage.cars) - - localStorage.cars = '[{"brand":"Renault","model":"Megane"},{"brand":"Peugeot","model":"208"}]' - - var cars = new Collection ('cars') - - var car = 'I am not an Object' - - var errorThrown - - try { - cars.insertOne(car) - } catch (error) { - errorThrown = error - } - - parsedCars = JSON.parse(localStorage.cars) - - expect(!!localStorage.cars).toBe(true) - expect(parsedCars.length).toBe(2) - - expect(parsedCars[0].brand).toBe('Renault') - expect(parsedCars[0].model).toBe('Megane') - - expect(parsedCars[1].brand).toBe('Peugeot') - expect(parsedCars[1].model).toBe('208') - - expect(errorThrown).toBeInstanceOf(TypeError) - expect(errorThrown.message).toBe('document is not an Object') - - delete (localStorage.cars) - }) - }) - - - - describe('updateOne', function(){ - it('should find a document in its Collection and change its values', function(){ - delete (localStorage.cars) - - localStorage.cars = '[{"brand":"Renault","model":"Megane","id":"1"},{"brand":"Peugeot","model":"208","id":"2"}]' - - var cars = new Collection('cars') - - var car = {brand: 'Toyota', model: 'Yaris', id: "1"} - - cars.updateOne(car) - - var parsedCars = JSON.parse(localStorage.cars) - - expect(!!parsedCars).toBe(true) - expect(parsedCars.length).toBe(2) - - expect(parsedCars[0].brand).toBe('Toyota') - expect(parsedCars[0].model).toBe('Yaris') - expect(parsedCars[0].id).toBe("1") - - expect(parsedCars[1].brand).toBe('Peugeot') - expect(parsedCars[1].model).toBe('208') - expect(parsedCars[1].id).toBe("2") - - delete (localStorage.cars) - }) - - - it('should fail on no matches', function(){ - delete (localStorage.cars) - - localStorage.cars = '[{"brand":"Renault","model":"Megane"},{"brand":"Peugeot","model":"208"}]' - - var cars = new Collection('cars') - - var car = {brand: 'Toyota', model: 'Yaris', id: '1'} - - cars.updateOne(car) - - var parsedCars = JSON.parse(localStorage.cars) - - expect(!!parsedCars).toBe(true) - expect(parsedCars.length).toBe(2) - - expect(parsedCars[0].brand).toBe('Renault') - expect(parsedCars[0].model).toBe('Megane') - - expect(parsedCars[1].brand).toBe('Peugeot') - expect(parsedCars[1].model).toBe('208') - - delete (localStorage.cars) - }) - - - it('should fail on non-Object document', function(){ - delete (localStorage.cars) - - localStorage.cars = '[{"brand":"Renault","model":"Megane","id":"1"},{"brand":"Peugeot","model":"208","id":"2"}]' - - var cars = new Collection('cars') - - var car = 'I am not an Object' - - var errorThrown - - try { - cars.updateOne(car) - } catch (error) { - errorThrown = error - } - - parsedCars = JSON.parse(localStorage.cars) - - expect(!!parsedCars).toBe(true) - expect(parsedCars.length).toBe(2) - - expect(parsedCars[0].brand).toBe('Renault') - expect(parsedCars[0].model).toBe('Megane') - expect(parsedCars[0].id).toBe("1") - - expect(parsedCars[1].brand).toBe('Peugeot') - expect(parsedCars[1].model).toBe('208') - expect(parsedCars[1].id).toBe("2") - - expect(errorThrown).toBeInstanceOf(TypeError) - expect(errorThrown.message).toBe('document is not an Object') - - delete (localStorage.cars) - }) - - it ('should fail on non-string document.id', function(){ - delete (localStorage.cars) - - localStorage.cars = '[{"brand":"Renault","model":"Megane","id":"1"},{"brand":"Peugeot","model":"208","id":"2"}]' - - var cars = new Collection('cars') - - var car = {brand: 'Toyota', model: 'Yaris', id: 1} - - var errorThrown - - try { - cars.updateOne(car) - } catch (error) { - errorThrown = error - } - - var parsedCars = JSON.parse(localStorage.cars) - - expect(!!parsedCars).toBe(true) - expect(parsedCars.length).toBe(2) - - expect(parsedCars[0].brand).toBe('Renault') - expect(parsedCars[0].model).toBe('Megane') - expect(parsedCars[0].id).toBe("1") - - expect(parsedCars[1].brand).toBe('Peugeot') - expect(parsedCars[1].model).toBe('208') - expect(parsedCars[1].id).toBe("2") - - expect(errorThrown).toBeInstanceOf(TypeError) - expect(errorThrown.message).toBe('id must be a string') - - delete (localStorage.cars) - }) - }) - - - - describe('deleteOne', function(){ - it('should delete document from Collection', function(){ - delete (localStorage.cars) - - localStorage.cars = '[{"brand":"Renault","model":"Megane","id":"1"},{"brand":"Peugeot","model":"208","id":"2"}]' - - var cars = new Collection('cars') - - var car = {brand: 'Renault', model: 'Megane', id: "1"} - - cars.deleteOne(function (car1){ - return car1.id === car.id - }) - - parsedCars = JSON.parse(localStorage.cars) - - expect(!!parsedCars).toBe(true) - expect(parsedCars.length).toBe(1) - - expect(parsedCars[0].brand).toBe('Peugeot') - expect(parsedCars[0].model).toBe('208') - expect(parsedCars[0].id).toBe('2') - - delete (localStorage.cars) - }) - - - it('should fail on no matches', function(){ - delete (localStorage.cars) - - localStorage.cars = '[{"brand":"Renault","model":"Megane","id":"1"},{"brand":"Peugeot","model":"208","id":"2"}]' - - var cars = new Collection('cars') - - var car = {brand: 'Toyota', model: 'Yaris', id: '3'} - - cars.deleteOne(function (car1){ - return car1.id === car.id - }) - - parsedCars = JSON.parse(localStorage.cars) - - expect(!!parsedCars).toBe(true) - expect(parsedCars.length).toBe(2) - - expect(parsedCars[0].brand).toBe('Renault') - expect(parsedCars[0].model).toBe('Megane') - expect(parsedCars[0].id).toBe('1') - - expect(parsedCars[1].brand).toBe('Peugeot') - expect(parsedCars[1].model).toBe('208') - expect(parsedCars[1].id).toBe('2') - - delete (localStorage.cars) - }) - - - it('should fail on non-Function callback', function(){ - delete (localStorage.cars) - - localStorage.cars = '[{"brand":"Renault","model":"Megane","id":"1"},{"brand":"Peugeot","model":"208","id":"2"}]' - - var cars = new Collection('cars') - - var car = {brand: 'Renault', model: 'Megane', id: '1'} - - var errorThrown - - try { - cars.deleteOne(car) - } catch (error) { - errorThrown = error - } - - parsedCars = JSON.parse(localStorage.cars) - - expect(!!parsedCars).toBe(true) - expect(parsedCars.length).toBe(2) - - expect(parsedCars[0].brand).toBe('Renault') - expect(parsedCars[0].model).toBe('Megane') - expect(parsedCars[0].id).toBe('1') - - expect(parsedCars[1].brand).toBe('Peugeot') - expect(parsedCars[1].model).toBe('208') - expect(parsedCars[1].id).toBe('2') - - expect(errorThrown).toBeInstanceOf(TypeError) - expect(errorThrown.message).toBe('callback is not a Function') - - delete (localStorage.cars) - }) - }) - - - - describe('getAll', function(){ - it('should return an Array of documents', function(){ - delete (localStorage.cars) - - localStorage.cars = '[{"brand":"Renault","model":"Megane","id":"1"},{"brand":"Peugeot","model":"208","id":"2"}]' - - var cars = new Collection('cars') - - documents = cars.getAll() - - expect(!!documents).toBe(true) - expect(Array.isArray(documents)).toBe(true) - expect(documents.length).toBe(2) - - expect(documents[0].brand).toBe('Renault') - expect(documents[0].model).toBe('Megane') - expect(documents[0].id).toBe('1') - - expect(documents[1].brand).toBe('Peugeot') - expect(documents[1].model).toBe('208') - expect(documents[1].id).toBe('2') - - delete (localStorage.cars) - }) - }) - - - - describe('printAll', function(){ - it('should print a table of a Collection', function(){ - delete (localStorage.cars) - - localStorage.cars = '[{"brand":"Renault","model":"Megane","id":"1"},{"brand":"Peugeot","model":"208","id":"2"}]' - - var cars = new Collection('cars') - - cars.printAll() - - delete (localStorage.cars) - }) - }) - }) -}) \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy/data/index.js b/staff/pere-hernandez/app/isdigram copy/data/index.js deleted file mode 100644 index 59dd63c3e..000000000 --- a/staff/pere-hernandez/app/isdigram copy/data/index.js +++ /dev/null @@ -1,7 +0,0 @@ -// data layer - -var data = { - users: new Collection('users'), - posts: new Collection('posts'), - chats: new Collection('chats') -} \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy/home.png b/staff/pere-hernandez/app/isdigram copy/home.png deleted file mode 100644 index 24ba4ea71..000000000 Binary files a/staff/pere-hernandez/app/isdigram copy/home.png and /dev/null differ diff --git a/staff/pere-hernandez/app/isdigram copy/home/index.css b/staff/pere-hernandez/app/isdigram copy/home/index.css deleted file mode 100644 index 27e3aa8f9..000000000 --- a/staff/pere-hernandez/app/isdigram copy/home/index.css +++ /dev/null @@ -1,277 +0,0 @@ -header { - position: fixed; - top: 0; - width: 100%; - display: flex; - align-items: end; - justify-content: space-between; - box-sizing: border-box; - background-color: #AFCDEF; -} - -#logo { - margin-left: 1vh; -} - -#logo-img { - max-width: 4vw; -} - - - -#logo-title{ - font-size: 3vh; - padding: 0; - margin: 0; - text-shadow: 0 0 0; -} - -#logout { - height: 50%; - border: 0; - margin-right: 2vw; - margin-bottom: 0.5vh; - background-color: #D9D9D9; -} - -h2{ - margin-top: 10vh; - padding-left: 2vw; -} - -#post-img { - display: flex; - justify-content: center; - align-items: center; - width: 8vw; - height: 80%; - border: 0; - border-radius: 50%; - font-size: 4vh; -} - -#create-post { - background: none; - border: 0; -} - -.image-div{ - align-self: center; - display: flex; - align-content: center; - justify-content: center; - background-color:rgb(236, 235, 235); -} - -time { - font-size: 1.2vh; - margin: 0%; - padding-left: 2vw; -} - -p { - margin-bottom: 0; - padding-left: 2vw; -} - -.delete-post-button, .update-post-button { - margin-top: 1vh ; -} - -#post-form-section { - display: none; - z-index: 2; - background: rgba(0, 0, 0, 0.5); - color: white; - width: 100%; - height: 100%; - position: fixed; - text-align: center; - flex-direction: column; - align-items: center; - justify-content: center; -} - -#postFormButton { - align-self: center; - width: 70vw; - margin-top: 2vh; - height: 4vh; - width: 60vw; - border: 0; - border-radius: 10px; - font-size: 2vh; - background-color: #6CA4E6; - color: aliceblue; - margin-bottom: 2vh; -} - -#return { - align-self: center; - width: 60vw; - height: 4vh; - border: 0; - border-radius: 10px; - font-size: 2vh; - background-color: #D9D9D9; -} - -footer { - position: fixed; - bottom: 0; - width: 100%; - height: 5%; - display: flex; - justify-content: center; - align-items: center; - box-sizing: border-box; - background-color: #AFCDEF; -} - -#chat-icon-button, #home-icon-button{ - width: 16vw; - background-color: white; - border: 0; -} - -#home-icon-button{ - display: none; -} - -ul { - border-top: 1px solid gray; - padding-left: 0; - font-size: 3vh; - background-color: #ebeaea; - list-style-position: inside; -} - -li { - padding: 1.5vh 0 1.5vh 4vw; - border-bottom: gray 1px solid; - margin: 0; -} - -.user-list-online::marker{ - color:limegreen; -} - -.user-list-offline::marker{ - color: red; -} - -#button-div{ - display: flex; - flex-direction: row; -} - -.chat-title { - box-sizing: border-box; - background-color: #AFCDEF; - margin-top: 2vh; - height: 8vh; - display: flex; - align-items: center; - font-size: 3vh; - padding-left: 2vw; - width: 100%; -} - -#chat-section { - height: 100%; - flex-direction: column; - align-items: flex-start; - justify-content: flex-start; -} - -.message-icon{ - max-height: 6vh; -} - -.chat-form{ - flex-direction: row; - align-items: center; - justify-content: space-between; - position: fixed; - bottom: 0; - background-color: #AFCDEF; - padding: 0; - width: 100%; - height: 8vh; -} - -#chat-text-input { - background-color: #f3f2f2; - height: 5vh; - margin: 0; - margin: 0 4vw 0 3vw; - padding: 0 2vw 0 2vw; -} - -.send-message-button { - display: flex; - background-color: #AFCDEF; - border: 0; - justify-content: center; - align-items: center; - height: 8vh; - width: 16vw; - padding: 0; - padding-right: 2vw; -} - -.chat-message-sent, .chat-message-recieved { - background-color: #AFCDEF; - padding: 1.5vw; - margin: 2vh 2vw 0 16vw; - border-radius: 5px; - width: fit-content; - align-self: flex-end; - margin-left: 8vw; -} - -.chat-message-recieved { - background-color: #D9D9D9; - align-self: flex-start; - margin: 2vh 16vw 0 2vw; -} - -.message-section { - width: 100%; -} - -.post-buttons-bar { - box-sizing: border-box; - display: flex; - width: 100%; - justify-content: space-between; - padding: 0 2vw 0 2vw; -} - -.edit-post-form { - display: none; - flex-direction: row; - margin: 2vh 2vw 0 2vw; -} - -.edit-post-input { - width: 100%; - margin: 0 4vw 0 0; - font-size: 4vw; -} - -.edit-post-button { - width: 16vw; - height: 4vh; - background-color: #6CA4E6; - color: white; - border: 0; - margin-right: 1vw; - border-radius: 5px; -} - -.return-from-edit-post-button { - border: 0; - border-radius: 5px; - background-color: #D9D9D9; -} \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy/home/index.html b/staff/pere-hernandez/app/isdigram copy/home/index.html deleted file mode 100644 index 9b54bc864..000000000 --- a/staff/pere-hernandez/app/isdigram copy/home/index.html +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - Home - - - - -
- - - -
- -

Hello, username!

- -
- - -
- - -
- -
- -
- -
- -
-
- - - - - - - -
- -
- - - - - - - - - - - - - \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy/home/index.js b/staff/pere-hernandez/app/isdigram copy/home/index.js deleted file mode 100644 index 8df1504ac..000000000 --- a/staff/pere-hernandez/app/isdigram copy/home/index.js +++ /dev/null @@ -1,347 +0,0 @@ -//presentation - -(function () { - if (!logic.checkLoggedInStatus()) { - location.href = '../login' - - return - } - - var greeting = document.getElementById('greeting') - var logoutButton = document.getElementById('logout') - var createPostForm = document.getElementById('create-post') - var postForm = document.getElementById('newPostForm') - var postListSection = document.getElementById('post-list-section') - var postFormSection = document.getElementById('post-form-section') - var returnButton = document.getElementById('return') - var body = document.querySelector('body') - var chatButton = document.getElementById('chat-icon-button') - var homeButton = document.getElementById('home-icon-button') - var footer = document.querySelector('footer') - var userList = document.getElementById('user-list') - var chatSection = document.getElementById('chat-section') - - - try { - var user = logic.retrieveUser() - - greeting.innerText = 'Hello, ' + user.username + '!' - - } catch (error) { - alert(error.message) - } - - - logoutButton.onclick = function () { - logic.logoutUser() - - location.href = '../login' - } - - - createPostForm.onclick = function (){ - postFormSection.style.display = 'flex' - body.style.overflow = 'hidden' - - - if (createPostForm.style.display === 'none') - createPostForm.style.display = 'flex' - else - createPostForm.style.display = 'none' - } - - - returnButton.onclick = function (){ - postFormSection.style.display = 'none' - createPostForm.style.display = 'flex' - postForm.reset() - body.style.overflow = 'scroll' - } - - - postForm.onsubmit = function (event){ - event.preventDefault() - body.style.overflow = 'scroll' - - var photoImput = document.getElementById('image') - var photo = photoImput.value - - var commentImput = document.getElementById('comment') - var comment = commentImput.value - - try { - logic.createPost(photo, comment) - postFormSection.style.display = 'none' - createPostForm.style.display = 'block' - postForm.reset() - - renderPosts() - - } catch (error) { - console.error(error) - alert(error.message) - } - } - - - function renderPosts(){ - try { - var posts = logic.retrievePosts() - - postListSection.innerHTML = '' - - posts.forEach(function (post) { - var article = document.createElement('article') - - var authorHeading = document.createElement('h3') - authorHeading.innerText = post.author.username - - var imageDiv = document.createElement('div') - imageDiv.classList.add('image-div') - - var image = document.createElement('img') - image.src = post.photo - - imageDiv.appendChild(image) - - var commentDiv = document.createElement('div') - commentDiv.classList.add('comment-div') - - var editPostForm = document.createElement('form') - editPostForm.classList.add('edit-post-form') - - var editPostInput = document.createElement('input') - editPostInput.classList.add('edit-post-input') - editPostInput.value = post.comment - - var editPostButton = document.createElement('button') - editPostButton.classList.add('edit-post-button') - editPostButton.style.type = 'submit' - editPostButton.innerHTML = 'Edit' - - var returnFromEditButton = document.createElement('button') - returnFromEditButton.classList.add('return-from-edit-post-button') - returnFromEditButton.innerHTML = 'Return' - - var paragraph = document.createElement('p') - paragraph.classList.add('comment-p') - paragraph.innerText = post.comment - - editPostForm.append(editPostInput, editPostButton, returnFromEditButton) - - returnFromEditButton.onclick = function (){ - paragraph.style.display = 'block' - editPostButton.style.display = 'block' - editPostForm.style.display = 'none' - - editPostForm.reset() - } - - editPostForm.onsubmit = function (){ - - editPostForm.style.display = 'none' - paragraph.style.display = 'block' - updatePostButton.style.display= 'block' - - var newComment = editPostInput.value - - logic.updatePost(post.id, newComment) - } - - commentDiv.append(paragraph, editPostForm) - - var dateTime = document.createElement('time') - dateTime.innerText = post.date - - article.append(authorHeading, imageDiv, commentDiv, dateTime) - - if (post.author.id === logic.getLoggedInUserId()){ - var postButtonsDiv = document.createElement('div') - postButtonsDiv.classList.add('post-buttons-bar') - - var deleteButton = document.createElement('button') - deleteButton.innerText = 'Delete' - deleteButton.classList.add('delete-post-button') - - var updatePostButton = document.createElement('button') - updatePostButton.innerText = 'Edit' - updatePostButton.classList.add('update-post-button') - - postButtonsDiv.append(deleteButton, updatePostButton) - - article.appendChild(postButtonsDiv) - - deleteButton.onclick = function () { - if (confirm('Delete post?')){ - try { - logic.deletePost(post.id) - - renderPosts() - } catch (error) { - console.error(error) - alert(error.message) - } - } - } - - updatePostButton.onclick = function () { - updatePostButton.style.display = 'none' - paragraph.style.display = 'none' - editPostForm.style.display = 'flex' - } - } - - postListSection.appendChild(article) - }) - } catch (error) { - alert(error.message) - } - - } - - var renderMessagesIntervalId - - - chatButton.onclick = function (){ - footer.style.display = 'none' - postListSection.style.display = 'none' - chatButton.style.display = 'none' - homeButton.style.display = 'block' - userList.style.display = 'block' - chatSection.style.display = 'none' - chatButton.style.display = 'none' - - userList.innerHTML = '' - - try { - var users = logic.retrieveUsers() - - users.forEach(function (user){ - var userLi = document.createElement('li') - - if (user.status === 'online'){ - userLi.classList.add('user-list-online') - } else if (user.status === 'offline'){ - userLi.classList.add('user-list-offline') - } - - userLi.innerHTML = user.username - - - - userLi.onclick = function (){ - chatSection.innerHTML = '' - userList.style.display = 'none' - chatButton.style.display = '' - - var chatTitle = document.createElement('div') - chatTitle.classList.add('chat-title') - chatTitle.innerHTML = user.username - - var messageSection = document.createElement('section') - messageSection.classList.add('message-section') - - var chatForm = document.createElement('form') - chatForm.classList.add('chat-form') - - var chatInputText = document.createElement('input') - chatInputText.type = 'text' - chatInputText.setAttribute('id', 'chat-text-input') - - var sendMessageButton = document.createElement('button') - sendMessageButton.type = 'submit' - sendMessageButton.classList.add('send-message-button') - - var messageIcon = document.createElement('img') - messageIcon.src = '../mail.png' - messageIcon.classList.add('message-icon') - - sendMessageButton.appendChild(messageIcon) - - chatForm.append(chatInputText, sendMessageButton) - - chatSection.append(chatTitle, messageSection, chatForm) - chatSection.style.display = 'flex' - - function renderMessages() { - try { - var messages = logic.retrieveMessagesWith(user.id) - - messageSection.innerHTML = '' - - messages.forEach(function (message){ - var messageP = document.createElement('p') - messageP.innerText = message.text - - if (message.author === sessionStorage.userId) - messageP.classList.add('chat-message-sent') - else - messageP.classList.add('chat-message-recieved') - - messageSection.appendChild(messageP) - }) - } catch (error) { - console.error(error) - - alert(error.message) - } - } - - renderMessages() - - clearInterval(renderMessagesIntervalId) - - renderMessagesIntervalId = setInterval(renderMessages, 1000) - - - - chatForm.onsubmit = function (){ - event.preventDefault() - - var messages = logic.retrieveMessagesWith(user.id) - var messageImput = document.getElementById('chat-text-input') - var messageText = messageImput.value - - if (messageText.length > 0){ - try { - var message = logic.createMessage(messageText) - - if (messages.length < 1) - var chat = logic.createChat(user) - else - var chat = logic.retrieveChatWith(user.id) - - logic.addMessageToChat(message, chat.id) - - chatForm.reset() - - renderMessages() - } catch (error) { - console.error(error) - - alert(error.message) - } - } - } - } - userList.appendChild(userLi) - }) - } catch (error) { - console.error(error) - - alert(error.message) - } - } - - - homeButton.onclick = function (){ - footer.style.display = '' - postListSection.style.display = 'flex' - chatButton.style.display = 'flex' - homeButton.style.display = '' - userList.style.display = 'none' - chatSection.style.display = 'none' - } - - renderPosts() -})() \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy/logic.js b/staff/pere-hernandez/app/isdigram copy/logic.js deleted file mode 100644 index 490ab22dd..000000000 --- a/staff/pere-hernandez/app/isdigram copy/logic.js +++ /dev/null @@ -1,330 +0,0 @@ -// business (logic) - -var logic = (function () { - - //constants - - var DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/ - var EMAIL_REGEX = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/ - var PASSWORD_REGEX = /^(?=.*[0-9])(?=.*[A-Za-z])[A-Za-z0-9]+$/ - var URL_REGEX = /^(http|https):\/\// - - - - //helpers - - function validateText(text, explain, checkEmptySpaceInside) { - if (typeof text !== 'string') - throw new TypeError (explain + ' ' + text + ' is not a string') - if (!text.trim().length) - throw new Error (explain + '>' + text + '< is empty or blank') - - if (checkEmptySpaceInside) - if(text.includes(' ')) - throw new Error (explain + ' ' + text + ' has empty spaces') - } - - - function validateDate(date, explain) { - if (!DATE_REGEX.test(date)) - throw new Error(explain + ' '+ date + ' is not a date') - } - - - function validateEmail(email, explain) { - if (!EMAIL_REGEX.test(email)) - throw new Error(explain + ' ' + email + ' is not an email') - } - - - function validatePassword(password, explain) { - if (!PASSWORD_REGEX.test(password)) - throw new Error(explain + ' ' + password + ' is not a valid password') - } - - - function validateUrl(url, explain) { - if (!URL_REGEX.test(url)) - throw new Error(explain + ' ' + url + ' is not an url') - } - - - - //logic - - //USER-related functions - - function registerUser(username, email, password, confirmedPassword){ - //validation - - validateText(username, 'username') - validateEmail(email, 'email') - - //logic - - if (password !== confirmedPassword){ - throw new Error("Passwords don't match") - } - - var user = data.users.findOne(function (user){ - return user.username === username || user.email === email - }) - - if (user) throw new Error ('user already exists') - - var user = { - username: username, - email: email, - password: password, - status: 'offline' - } - - data.users.insertOne(user) - } - - - function loginUser (username, password){ - //validation - - validateText(username, 'username', true) - - - //logic - - var user = data.users.findOne(function (user){ - return user.username === username && user.password === password - }) - - if (!user) throw new Error ('wrong credentials') - - user.status = 'online' - - data.users.updateOne(user) - - sessionStorage.userId = user.id - } - - - function retrieveUser (){ - var user = data.users.findOne(function(user){ - return user.id === sessionStorage.userId - }) - - if (!user) throw new Error('user not found') - - return user - } - - - function retrieveUsers(){ - var users = data.users.getAll() - - var index = users.findIndex(function (user) { - return user.id === sessionStorage.userId - }) - - users.splice(index, 1) - - users.forEach(function (user) { - delete user.email - delete user.password - }) - - users.sort(function (x, y) { - return x.username < y.username ? -1 : 1 - }).sort(function(x, y) { - return x.status > y.status ? -1 : 1 - }) - - return users - } - - - function logoutUser(){ - var user = data.users.findOne(function (user) { - return user.id === sessionStorage.userId - }) - - if (!user){ - throw new Error('wrong credentials') - } - - user.status = 'offline' - - data.users.updateOne(user) - - delete sessionStorage.userId - } - - - function getLoggedInUserId () { - return sessionStorage.userId - } - - function checkLoggedInStatus(){ - return !!sessionStorage.userId - } - - - - //POST-related functions - - function createPost (photo, comment){ - //validation - - validateText(comment, 'comment') - - //logic - - var post = { - author: sessionStorage.userId, - photo: photo, - comment: comment, - date: new Date().toLocaleDateString('en-CA') - } - - data.posts.insertOne(post) - } - - - function retrievePosts(){ - var posts = data.posts.getAll() - - posts.forEach(function (post) { - var user = data.users.findOne(function (user) { - return user.id === post.author - }) - - post.author = {id: user.id, username: user.username} - }) - return posts.reverse() - } - - - function deletePost (postId) { - //validation - - validateText(postId, 'PostId', true) - - //logic - var post = data.posts.findOne(function (post) { - return post.id === postId - }) - - if (!post) throw new Error ('post not found') - - if (post.author !== sessionStorage.userId) throw new Error ("can't delete somebody else's post") - - data.posts.deleteOne(function (post) { - return post.id === postId - }) - } - - - function updatePost (postId, text){ - //validation - - validateText(postId, 'PostId', true) - validateText(text, 'text') - - //logic - var post = data.posts.findOne(function (post){ - return post.id === postId - }) - - if (!post) - throw new Error ('post not found') - - if (post.author !== sessionStorage.userId) - throw new Error ('post does not belong to user') - - post.comment = text - - data.posts.updateOne(post) - } - - - - //CHAT-related functions - - function createChat(user){ - var chat = { - users: [sessionStorage.userId, user.id], - messages: [], - date: new Date().toLocaleDateString('en-CA') - } - - data.chats.insertOne(chat) - - return chat - } - - - function addMessageToChat (message, chatId){ - var chat = data.chats.findOne(function (chat){ - return chatId === chat.id - }) - - chat.messages.push(message) - - data.chats.updateOne(chat) - } - - - function retrieveMessagesWith (userID){ - var chat = data.chats.findOne(function (chat) { - return chat.users.includes(userID) && chat.users.includes(sessionStorage.userId) - }) - - if (chat) - return chat.messages - else - return [] - } - - - function retrieveChatWith (userID){ - var chat = data.chats.findOne(function(chat){ - return chat.users.includes(userID) && chat.users.includes(sessionStorage.userId) - }) - - if (!chat) throw new Error('user not found') - - return chat - } - - - - //MESSAGE-related functions - - function createMessage(message){ - var message = { - text: message, - author: sessionStorage.userId, - time: new Date().toLocaleDateString('en-CA') - } - return message - } - - return { - registerUser: registerUser, - loginUser: loginUser, - retrieveUser: retrieveUser, - retrieveUsers, retrieveUsers, - logoutUser: logoutUser, - getLoggedInUserId: getLoggedInUserId, - checkLoggedInStatus: checkLoggedInStatus, - - createPost: createPost, - retrievePosts: retrievePosts, - deletePost: deletePost, - updatePost: updatePost, - - createChat: createChat, - addMessageToChat: addMessageToChat, - retrieveMessagesWith: retrieveMessagesWith, - retrieveChatWith: retrieveChatWith, - - createMessage: createMessage - } -}) () \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy/login/index.css b/staff/pere-hernandez/app/isdigram copy/login/index.css deleted file mode 100644 index 6ff44c5c2..000000000 --- a/staff/pere-hernandez/app/isdigram copy/login/index.css +++ /dev/null @@ -1,70 +0,0 @@ -body { - margin: 0; - display: flex; - justify-content: center; - align-items: center; - box-sizing: border-box; -} - -h1 { - margin: 0; -} - -#title { - margin: 0; -} - -#terms { - margin: 0; - margin-right: 2vw; - max-height: 2vh; - max-width: 2vh; -} - -#terms-text { - font-size: 1.5vh; -} - -#login-button{ - width: 70vw; - margin-top: 2vh; - height: 8vh; - border: 0; - border-radius: 10px; - font-size: 3vh; - background-color: #6CA4E6; - color: aliceblue; -} - -#register-button{ - width: 70vw; - margin-top: 2vh; - height: 8vh; - border: 0; - background-color: #D9D9D9; - border-radius: 10px; - font-size: 3vh; -} - -#termsDiv{ - width: 100%; - align-self: center; - display: flex; - justify-content: center; - align-items: center; - margin-bottom: 3vh; - margin-top: 3vh; -} - -h2{ - margin-top: 0; - font-size: 2vh; - align-self: center; - justify-self: center; -} - -#title { - display: flex; - flex-direction: column; - margin-bottom: 8vh; -} \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy/login/index.html b/staff/pere-hernandez/app/isdigram copy/login/index.html deleted file mode 100644 index 4586aa198..000000000 --- a/staff/pere-hernandez/app/isdigram copy/login/index.html +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - Login - - - - -
- -

Isdigram.

-

Ad astra per aspera

-
- -
- - - - - -
- - - - - - - - - - - - - \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy/login/index.js b/staff/pere-hernandez/app/isdigram copy/login/index.js deleted file mode 100644 index 4eb21a802..000000000 --- a/staff/pere-hernandez/app/isdigram copy/login/index.js +++ /dev/null @@ -1,29 +0,0 @@ -//presentation - -(function () { - if (logic.checkLoggedInStatus()){ - location.href = '../home' - - return - } - - - var form = document.querySelector('form') - - form.addEventListener('submit', function (event){ - event.preventDefault() - - var usernameImput = document.getElementById('username') - var username = usernameImput.value - - var passwordInput = document.getElementById('password') - var password = passwordInput.value - - try { - logic.loginUser(username, password) - location.href = '../home' - } catch (error) { - alert(error.message) - } - }) -})() \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy/logo.png b/staff/pere-hernandez/app/isdigram copy/logo.png deleted file mode 100644 index dca6a2afa..000000000 Binary files a/staff/pere-hernandez/app/isdigram copy/logo.png and /dev/null differ diff --git a/staff/pere-hernandez/app/isdigram copy/mail.png b/staff/pere-hernandez/app/isdigram copy/mail.png deleted file mode 100644 index b6c713850..000000000 Binary files a/staff/pere-hernandez/app/isdigram copy/mail.png and /dev/null differ diff --git a/staff/pere-hernandez/app/isdigram copy/photo.png b/staff/pere-hernandez/app/isdigram copy/photo.png deleted file mode 100644 index 19a0367f7..000000000 Binary files a/staff/pere-hernandez/app/isdigram copy/photo.png and /dev/null differ diff --git a/staff/pere-hernandez/app/isdigram copy/register/index.css b/staff/pere-hernandez/app/isdigram copy/register/index.css deleted file mode 100644 index 77c525953..000000000 --- a/staff/pere-hernandez/app/isdigram copy/register/index.css +++ /dev/null @@ -1,63 +0,0 @@ -body { - margin: 0; - display: flex; - justify-content: center; - align-items: center; - box-sizing: border-box; -} - -#interactive-content { - width: 70vw; - margin: 0; - margin-top: 4vh; -} - -h1 { - margin: 0; -} - -#title { - margin: 0; -} - -#terms { - margin: 0; - margin-right: 2vw; - max-height: 2vh; - max-width: 2vh; -} - -#terms-text { - font-size: 1.5vh; -} - -#login-button{ - width: 70vw; - margin-top: 2vh; - height: 8vh; - border: 0; - background-color: #D9D9D9; - border-radius: 10px; - font-size: 3vh; -} - -#register-button{ - width: 70vw; - margin-top: 2vh; - height: 8vh; - border: 0; - background-color: #6CA4E6; - color: aliceblue; - border-radius: 10px; - font-size: 3vh; -} - -#termsDiv{ - width: 100%; - align-self: center; - display: flex; - justify-content: center; - align-items: center; - margin-bottom: 3vh; - margin-top: 3vh; -} \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy/register/index.html b/staff/pere-hernandez/app/isdigram copy/register/index.html deleted file mode 100644 index 49b8cc8ca..000000000 --- a/staff/pere-hernandez/app/isdigram copy/register/index.html +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - Register - - - - -
- -

Isdigram.

-
- -
-
- - - - - - - - - - - - -
- - -
- - -
- - -
- - - - - - - - - - - \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy/register/index.js b/staff/pere-hernandez/app/isdigram copy/register/index.js deleted file mode 100644 index e5abcd019..000000000 --- a/staff/pere-hernandez/app/isdigram copy/register/index.js +++ /dev/null @@ -1,32 +0,0 @@ -//presentation - -(function () { - var form = document.querySelector('form') - var loginLink = document.querySelector('a') - - form.addEventListener('submit', function (event){ - event.preventDefault() - - var usernameImput = document.getElementById('username') - var username = usernameImput.value - - var emailImput = document.getElementById('email') - var email = emailImput.value - - var passwordImput = document.getElementById('password') - var password = passwordImput.value - - var confimrPasswordImput = document.getElementById('confirm') - var confirmedPassword = confimrPasswordImput.value - - try { - logic.registerUser(username, email, password, confirmedPassword) - - form.reset() - - location.href = '../login' - } catch (error) { - alert(error.message) - } - }) -})() diff --git a/staff/pere-hernandez/app/isdigram copy/styles.css b/staff/pere-hernandez/app/isdigram copy/styles.css deleted file mode 100644 index beee7d0e1..000000000 --- a/staff/pere-hernandez/app/isdigram copy/styles.css +++ /dev/null @@ -1,81 +0,0 @@ -body, form, #interactive-content { - display: flex; - flex-direction: column; - margin: 0; - font-size: 2vh; - font-family: 'Open-sans', sans-serif; - overflow: scroll; -} - -body { - height: 100vh; -} - -h1{ - font-size: 7vh; - margin-top: 0; -} - -input { - background-color: #AFCDEF; - border: none; - width: 100%; - height: 4vh; - margin-bottom: 2vh; - box-sizing: border-box; -} - -#title { - margin-top: 2vh; -} - -#title-logo { - margin-bottom: 0; - max-width: 5vh; -} - -#newPostForm { - width: 80%; -} - -#return { - margin-bottom: 7vh; - max-width: 20vw; -} - -h2 { - font-size: 7vw; -} - -section { - display: flex; - justify-content: center; - flex-direction: column; -} - -article { - margin-bottom: 5vh; -} - -img { - max-width: 100%; -} - -#post-list-section { - display: flex; - flex-direction: column; -} - -#post-form-section { - display: none; -} - -.delete-post-button { - display: flex; - justify-self: flex-end; - margin-top: 2vh; -} - -h3{ - padding-left: 2vw; -} \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram copy/vendor/matcha.js b/staff/pere-hernandez/app/isdigram copy/vendor/matcha.js deleted file mode 100644 index dbecc146f..000000000 --- a/staff/pere-hernandez/app/isdigram copy/vendor/matcha.js +++ /dev/null @@ -1,73 +0,0 @@ -console.log('MATCHA 🍵 v0.1') - -var matcha = {} - -var logs = [] - -function describe(title, callback) { - logs[logs.length] = title - console.log(title) - - callback() -} - -function it(title, callback) { - var log = '* ' + title - - logs[logs.length] = log - console.log(log) - - callback() -} - -function expect(value) { - return { - toBe: function (expected) { - var matches = value === expected - - if (!matches) { - var log = '❌ ' + value + ' to be ' + expected - - logs[logs.length] = log - console.error(log) - - return false - } - - var log = '✅ ' + value + ' to be ' + expected - - logs[logs.length] = log - console.info(log) - - return true - }, - - toBeInstanceOf: function (expected) { - var matches = value instanceof expected - - if (!matches) { - var log = '❌ ' + value + ' to be instance of ' + expected.name - - logs[logs.length] = log - console.error(log) - - return false - } - - var log = '✅ ' + value + ' to be instance of ' + expected.name - - logs[logs.length] = log - console.info(log) - - return true - } - } -} - -matcha.logs = logs -matcha.describe = describe -matcha.it = it -matcha.expect = expect - -if (typeof module !== 'undefined') - module.exports = matcha \ No newline at end of file diff --git a/staff/pere-hernandez/app/isdigram/components/library/Chat.mjs b/staff/pere-hernandez/app/isdigram/components/library/Chat.mjs index 2f2191a9f..49512fa06 100644 --- a/staff/pere-hernandez/app/isdigram/components/library/Chat.mjs +++ b/staff/pere-hernandez/app/isdigram/components/library/Chat.mjs @@ -1,6 +1,8 @@ import Component from "../core/Component.mjs"; import UserList from "./UserList.mjs"; +import Button from "../core/Button.mjs"; +import Image from "../core/Image.mjs"; import MessageList from "./MessageList.mjs"; import CreateMessage from "./CreateMessage.mjs"; @@ -11,41 +13,50 @@ class Chat extends Component { this.setId('chat-section') const userList = new UserList + let titleDiv let chatTitle this._messageList let messageForm userList.onUserClick(user => { this.remove(userList) + + titleDiv = new Component() + titleDiv.setClass('title-div') - if(!chatTitle){ - chatTitle = new Component ('h3') - chatTitle.setClass('chat-title') - this.add(chatTitle) - } + chatTitle = new Component ('h3') + chatTitle.setClass('chat-title') - chatTitle.setText(user.username) + const returnButton = new Button + returnButton.setClass('transparent-button') - if(!this._messageList) { - this._messageList = new MessageList(user) - messageForm = new CreateMessage(user) + returnButton.onClick(() => { + this.remove(titleDiv) + this.remove(this._messageList) + this.remove(messageForm) - messageForm.onMessageSent(() => this._messageList.refresh()) + this.add(userList) + }) - this.add(this._messageList, messageForm) - } else { - const oldMessageList = this._messageList - const oldMessageForm = messageForm + const returnImage = new Image + returnImage.setSource('../../return.png') + returnImage.setClass('return-img') + + returnButton.add(returnImage) + + titleDiv.add(chatTitle, returnButton) + + chatTitle.setText(user.username) + + this.add(titleDiv) this._messageList = new MessageList(user) messageForm = new CreateMessage(user) messageForm.onMessageSent(() => this._messageList.refresh()) - this.replace(oldMessageList, this._messageList) - this.replace(oldMessageForm, messageForm) - } - }) + this.add(this._messageList, messageForm) + }) this.add(userList) diff --git a/staff/pere-hernandez/app/isdigram/index.css b/staff/pere-hernandez/app/isdigram/index.css index 93362ef34..502a2d3ac 100644 --- a/staff/pere-hernandez/app/isdigram/index.css +++ b/staff/pere-hernandez/app/isdigram/index.css @@ -56,6 +56,8 @@ li { background-color: transparent; border: 0; display: flex; + justify-content: center; + align-items: center; } article { @@ -301,14 +303,26 @@ header { /*Chat styles*/ +.title-div{ + display: flex; + flex-direction: row; + justify-content: space-between; + background-color:#AFCDEF; + margin-top: 2vh; +} + .chat-title { display: flex; align-items: center; - background-color:#AFCDEF; font-size: 8vw; padding-left: 2vw; height: 8vh; - margin: 2vh 0 0 0; + margin: 0; +} + +.return-img { + width: 12vw; + transform: rotate(-0.25turn); } .message-form { diff --git a/staff/pere-hernandez/app/isdigram/return.png b/staff/pere-hernandez/app/isdigram/return.png new file mode 100644 index 000000000..8a5ab729f Binary files /dev/null and b/staff/pere-hernandez/app/isdigram/return.png differ