Skip to content
This repository has been archived by the owner on Jul 5, 2021. It is now read-only.

Feature: Alert bar for IPFS #289

Closed
wants to merge 15 commits into from
Closed
1 change: 1 addition & 0 deletions content/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
</head>

<body class="home">
{{ partial "alert-bar.html" }}
{{ partial "header.html" (dict "hero" "homepage" "baseUrl" ($.Param " baseURL ") "page" .) }}

<div class="container">
Expand Down
36 changes: 36 additions & 0 deletions content/ipfs-call/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
pagetype: major
pagename: IPFS Weekly Call
section: IPFS Weekly Call
title: IPFS Weekly Call
url: call
save_as: call/index.html
constellation: constellation-02.svg
---

## Welcome to the IPFS Weekly Call

Join us every week for the IPFS Weekly Call where we hear from the IPFS Community. Our calls start 17 UTC every Monday. We use zoom to host our calls and [this link](https://protocol.zoom.us/j/443621844) will directly bring you into the live video chat.

Before you join there are several points we would like to go over:

1. The IPFS calls are recorded and are put on [Youtube](https://www.youtube.com/playlist?list=PLuhRWgmPaHtSGRSHdU9dbsukHKlihZZAe)
2. Have a read of the agenda for the call, and add your name as an attendee on the [IPFS Weekly Call document](https://docs.google.com/document/d/1WHyIZhBo2eEgYXlZ5HLHg6a6ZWTH3tV848sWkYBJjJA/edit#heading=h.hz5t61tdc5r6)
3. We expect all participants to abide by the [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. We expect all participants to abide by the Code of Conduct.


### Call Format

1. IPFS Announcements and Demos
2. Main Presentation
3. Q&A



## Code of Conduct

We believe that our mission is best served in an environment that is friendly, safe, and accepting; free from intimidation or harassment.

Towards this end, certain behaviors and practices will not be tolerated.

You can learn more about our Code of Conduct [here](https://github.com/ipfs/community/blob/master/code-of-conduct.md).
2 changes: 2 additions & 0 deletions js/header-and-latest.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
var stars = require('./lib/stars')
var popup = require('./lib/popup')
var blogFeed = require('./lib/blog-feed')
var alertBar = require('./lib/alert-bar')

stars()
popup()
blogFeed()
alertBar()
26 changes: 26 additions & 0 deletions js/lib/alert-bar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
var $ = require('jquery')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not import jquery just to create a pop up

http://youmightnotneedjquery.com/

Copy link
Author

@pkafei pkafei Feb 11, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ya, we’re already using it on two other pages. if someone wants to send a PR to remove it’s use throughout the site, fine, but I don’t see why we would hold up new contributions since it’s not actually adding a dependency.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jquery wouldn't be my first choice either, but it is already used in ipfs.io site.

Understood. Although I would argue that the best way to default not be the first choice anymore is to move away from it rather than adding it in more places.

var callData = require('./communityCall.json')

function shouldShowBanner (date, startTimeString, startDay) {
var now = date.getUTCHours()
var startTime = parseInt(startTimeString, 10)
var dayOfWeek = date.getUTCDay()

if ((startTime - now <= 2 && startTime - now >= parseFloat(-0.5) && (dayOfWeek === startDay))) {
return true
}
return false
}

module.exports.shouldShowBanner = shouldShowBanner

function callTime () {
var reminder = $('.alert-bar')
if (shouldShowBanner(new Date(), callData.time, callData.day)) {
$('.alert-bar-message').append('<span>The IPFS community call will start at ' + callData.time + '. Join us <a href=' + callData.callPage + ' style="color: #0073b5; text-decoration: underline">here</a></span>')
reminder.show()
} else {
reminder.hide()
}
}
callTime()
7 changes: 7 additions & 0 deletions js/lib/communityCall.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"callName": "IPFS Weekly Call",
"time": "17:00 UTC",
"day": 1,
"callPage": "/call",
"zoomLink": "https://protocol.zoom.us/j/443621844"
}
19 changes: 19 additions & 0 deletions js/lib/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
var assert = require('assert')
var shouldShowBanner = require('./alert-bar').shouldShowBanner

describe('shouldShowBanner', function () {
it('should return false if the time is more than 2.5 hours before the call', function () {
var wednesday = new Date('2019-03-13T18:33:05.629Z')
assert.equal(shouldShowBanner(wednesday, '17:00 UTC', 1), false)
})

it('should return if the time is within 2.5 hours before the call', function () {
var monday = new Date('2019-03-11T16:33:05.629Z')
assert.equal(shouldShowBanner(monday, '17:00 UTC', 1), true)
})

it('should return true if the time is during the call', function () {
var monday = new Date('2019-03-11T17:29:05.629Z')
assert.equal(shouldShowBanner(monday, '17:00 UTC', 1), true)
})
})
7 changes: 7 additions & 0 deletions layouts/partials/alert-bar.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<div class="flex items-center justify-center pa2 navy alert-bar" style="display: none; background-color: #e2f4ff;">
<svg class="w1" data-icon="info" viewBox="0 0 32 32" style="fill:currentcolor">
<title>info icon</title>
<path d="M16 0 A16 16 0 0 1 16 32 A16 16 0 0 1 16 0 M19 15 L13 15 L13 26 L19 26 z M16 6 A3 3 0 0 0 16 12 A3 3 0 0 0 16 6"></path>
</svg>
<span class="lh-title ml3 alert-bar-message"></span>
</div>
1 change: 1 addition & 0 deletions less/main.less
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
@import 'components/code';
@import 'components/blog';
@import (less) 'node_modules/magnific-popup/dist/magnific-popup.css';
@import (less) 'node_modules/tachyons/css/tachyons.css';

@import 'pages/home';
@import 'pages/docs';
Expand Down
11 changes: 9 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
{
"name": "ipfs.io",
"private": true,
"dependencies": {},
"dependencies": {
"chai": "^4.2.0",
"hugo": "0.0.3",
"mocha": "^6.0.2",
"tachyons": "^4.10.0"
},
"devDependencies": {
"browserify": "^14.4.0",
"dnslink-deploy": "^1.0.7",
Expand All @@ -12,6 +17,8 @@
"imagemin-optipng": "^5.2.1",
"imagemin-svgo": "^5.2.2",
"jquery": "^3.2.1",
"jsdom": "14.0.0",
"jsdom-global": "3.0.2",
"less": "^2.7.2",
"less-plugin-autoprefix": "^1.5.1",
"less-plugin-clean-css": "^1.5.1",
Expand All @@ -37,7 +44,7 @@
"minify": "npm-run-all minify:*",
"minify:img": "find public/images -type d -exec imagemin {}/* --out-dir={} \\; && find public/blog/static -type d -exec imagemin {}/* --out-dir={} \\;",
"minify:js": "find public/js -name '*.js' -exec uglifyjs {} --compress --output {} \\;",
"test": "echo \"Error: no test specified\" && exit 1",
"test": "mocha -r jsdom-global/register --recursive './js/lib/test.js'",
"watch": "npm-run-all -p watch:*",
"watch:css": "stylus -u autoprefixer-stylus -I node_modules/yeticss/lib -w _styl/main.styl -c -o static/css",
"watch:js": "nodemon --watch js --exec \"browserify js/popup.js -o static/js/popup.js && browserify js/stars.js -o static/js/stars.js\"",
Expand Down