Commit Graph

43 Commits

Author SHA1 Message Date
piekar294
2bba16c298 Remove use of componentWillReceiveProps() (#2192) 2018-10-20 09:11:36 +01:00
piekar294
37c317a758 remove react-warning-keys warning in renderNamedLogos (#2193) 2018-10-19 19:18:38 +01:00
chris48s
edab5385f8 show examples with logos on index page (#2084) 2018-09-19 22:05:38 +01:00
Paul Melnikow
55f4017388 Combined update of eslint dependencies (#2007) 2018-08-29 15:01:25 -07:00
Paul Melnikow
1deeb365a5 Update uri -> url in the front end + examples (#2006)
This continues a consistency update we’ve been making to standardize on URL based on a recommendation from WHATWG: https://url.spec.whatwg.org/#goals

This also helps with copying and pasting between all-badge-examples and new-style services, where it’s otherwise easy to make a mistake.

Ref: #1322 #1341
2018-08-29 14:27:50 -07:00
Paul Melnikow
f8f2d88b90 Clean up some alerts detected by LGTM (#2010)
https://lgtm.com/projects/g/badges/shields/alerts/?mode=list
2018-08-29 13:37:43 -07:00
chris48s
ae190c5f07 generate static examples without api call [apm appveyor cdnjs clojars gem npm uptimerobot] (#1740)
* allow service classes to define a static example
* define static example for some services
  (apm, appveyor, cdnjs, clojars, gem, librariesio, npm, uptimerobot)
* add/update tests


This allows us to show an example without making an API call to a live service for better performance.

We can now specify 3 fields in the example definition:

* urlPattern for the version with placeholders e.g: /npm/dw/:package.svg
* ExampleUrl/Uri for the concrete example e.g: /npm/dw/localeval.svg
* PreviewUrl/Uri for the static (or live) image we will actually show
2018-08-23 20:22:24 +01:00
Paul Melnikow
66d444aa40 Clean up our callback style and enforce no exclusive tests and remove an exclusive test (#1900)
We use arrow functions in most places; this enforces it.

Passing arrow functions to Mocha is discouraged: https://mochajs.org/#arrow-functions

This was a mix of autofixes and hand adjustments.
2018-08-12 20:45:43 -04:00
Paul Melnikow
7a664ca3e8 Run prettier (#1866)
Merging this separately so the commit with the tooling change is readable. This is a follow-on to #1167 which turned prettier on.
2018-08-08 17:57:14 -04:00
Pyves
da403b7e3a Increased default BADGE_MAX_AGE_SECONDS (#1846)
* Added note about default on website
2018-08-06 22:36:10 -04:00
Danial
317e19ea2a Add support for simple-icons, colored icons with ?logoColor (#1810)
* add simple-icons

* handle undefined

* support logoColor param

* our icon > simple-icon

* dont crash 

* return false → undefined

* update test

* add test

* support logoColor on our logos

* cache as base64, pre-load-simple-icons, logo-helper

* add ?logoColor information

* and simple-icons reference, link to github master branch for our logos

* update simple-icons

update to 1.7.1

* Revert "and simple-icons reference, link to github master branch for our logos"

This reverts commit 5e99d5f8db.

* add link to simple-icons

* Add snapshot test

* support dash in place of space for logo name
2018-08-02 09:07:23 +12:00
chris48s
901a7b8a43 Split front end into one page per category (#1808)
- Present 'downloads', 'version', etc as pages
- Don't show any badges on the index page,
  just links to categories.
- Tweak search so we can search all badges
  from the index page, but without rendering
  every badge as soon as we press a key.
2018-08-01 21:02:55 +01:00
Paul Melnikow
5a62ed59fe List the named logos in the frontend (#1794)
Fix #1787
2018-07-23 15:19:55 -05:00
chris48s
b9db222c8a send longer cache headers by default (#1725)
* tell browsers and downstream caches to cache for
  `env.BADGE_MAX_AGE_SECONDS`, default 0 for dev

* set Cache-Control: no-cache, no-store, must-revalidate if maxAge=0

* add servertime badge to help with cache header debugging

* if service category is 'debug', exclude from examples

* ignore maxAge GET param if less than `env.BADGE_MAX_AGE_SECONDS`
2018-07-20 20:24:02 +01:00
Danial
d8cf836264 Add support for rgb, rgba, hsl, hsla, css named colors (#1635)
* add support for rgb, rgb, css named colors

* add support for hsl, hsla & add color-validate

* update makeBadge test, better coverage

* re-add comment

* add comment for supported colors

* dynamic badge gen, remove 'hex'

* add support for 1.0 opacity & fix 101-109

* fix colorscheme tests

* remove extra tests

* add test for negative values

* add test for uppercase & mixed case colors

* fix mixed case/uppercase test

* allow whitespace around color

* update test error messages

* add comments

* add more uppercase test

* update error message

* default to grey/red if invalid color chosen

default colorscheme:
colorA: grey
colorB: red

* Revert "default to grey/red if invalid color chosen"

This reverts commit 10db0c6d74.
Reverted as this affects the CLI version/when no color specified.

* validColor -> isCSSColor

* assignColor function

* update tests to use sazerac
2018-07-12 10:26:17 +12:00
Jacob Tomlinson
d56b6961da Add [dynamic-yaml] badge (#1623)
* Add dynamic yaml badge

* Forgot package lock

* Switch tests to yaml data source

* Add yaml to the dynamic badge maker options

* Reorder to match documentation examples

* Reordered dynamic types to be alphabetical

* Removed regex as pinend commit makes it unnecessary and fixed url

* Removed unused import

* Add more YAML MIME types

* Removed duplicate tests which don't differ between data types
2018-04-08 21:47:28 +02:00
Paul Melnikow
3a47bb38ac Searches with regex control characters should not crash (#1579)
Fix #1578
2018-03-17 16:52:41 -04:00
greenkeeper[bot]
2d5a088d6f Update next to the latest version 🚀 (#1490)
* chore(package): update next to version 5.0.0

* Update package-lock

* Get build + tests passing
2018-03-08 09:18:52 -08:00
Danial
be09cee1f2 User defined XML source badge [dynamic-xml dynamic-json] (#1494)
* add dynamic xml badge support

* add tests

* dynamic badge add tests for query param

* remove try catch

* use `checkErrorResponse()`

* update tests

* [dynamic json] add test for multiple items

* Rebase, [dynamic xml] Add support for multiple items

* 404 response -> resource not found

* multiple results test less greedy regex

still alot of room for improvement to this test

* update dynamic badge gen

* add dynamic xml gen tests

* update tests id & path

* datalist -> select

* uri -> url

kept support for uri, incase of any already existing badges.

* split dynamic gen uri

* update query placeholder
2018-03-06 22:43:02 +01:00
Danial
9aafe86247 Show logos by default on social badges (regression fix) (#1456)
* Show logos on social badges

* Revert "Showcase logos in social badges on the front page"

This reverts commit 61fa22b7e4.

* Update footer badges to all be social style

as per reverted commit 61fa22b7e4
2018-01-21 23:57:58 +01:00
Thaddee Tyl
61fa22b7e4 Showcase logos in social badges on the front page 2018-01-13 15:33:41 +01:00
Paul Melnikow
105e383d93 Improve search performance (#1393)
Add a class which applies display: none to badges we don’t want to see. This is accomplished by passing a `shouldDisplay` function along with each badge, which pulls the current query through a closure and applies it.

A bit roundabout, but it works.

The rest of the changes are refactors to avoid code duplication.

I decreased the debouce rate to 50, which seems to work well.

Fix #1314
2017-12-26 23:53:15 -05:00
Pravdomil
e4fed8d178 Copyedit and add link in footer (#1366) 2017-12-21 18:34:48 -05:00
Danial
e243959420 add spacing between badges in footer (#1347) 2017-12-07 10:28:34 +13:00
Paul Melnikow
212903d0e1 Fix dynamic badge URL generator (#1344)
Fix #1339
2017-12-06 14:38:41 -05:00
tooomm
b33b8d5b53 uri --> url (#1341) 2017-12-06 11:05:18 -05:00
Paul Melnikow
7c1b1fc621 Fix style picker in markup modal (#1331)
- Restore correct list of styles to markup modal
- DRY lists of styles

Fix #1330
2017-12-05 18:08:13 -05:00
Paul Melnikow
1eedd458b8 Fix and refactor front-end URL generation (#1322)
- Fix issue in Firefox 57 when run from static build
- Fix color parameter in dynamic badge maker
- Correctly apply maxAge in usage badges
- Follow the WHATWG lead and begin to standardize on URL, not URI (https://url.spec.whatwg.org/#goals)
2017-12-04 10:08:54 -05:00
Paul Melnikow
33690c5555 Fix missing whitespace in usage + footer
Use Fragment support added in React 16.2:

https://reactjs.org/blog/2017/11/28/react-v16.2.0-fragment-support.html
2017-12-03 15:12:22 -05:00
Paul Melnikow
8d0b1347d7 Fix markup modal when baseUri is unset (#1307) 2017-12-01 16:51:15 -05:00
Paul Melnikow
2be271c22b Frontend: Allow BASE_URL to be unset (#1306)
- Do not use bogus `'undefined'` as base URI
2017-12-01 16:34:31 -05:00
Paul Melnikow
8fa751d0c5 Activating Open Collective (#1295)
See comments in #1250. Gratipay is shutting down.
2017-11-30 14:19:50 -05:00
Paul Melnikow
f403c2b5d3 Configure frontend tests (#1293)
While working on #1288 I configured frontend tests. I'm going in a different direction with that, though it seems worth keeping the test configuration. I added tests for one of the helper methods.
2017-11-29 18:19:05 -05:00
Paul Melnikow
c5e31b5de1 Fix frontend deploy and Heroku staging (#1288)
- Heroku reads the Node version from package.json. We're about to upgrade to Node 8 so this change to `engines` is only pre-emptive. It won't have any effect on the production servers.
- The production deploy scripts were missing the frontend files. This fixes that.
- This modifies the build setup to allow `BASE_URL=/`, which makes all requests relative to the page itself. That simplifies deploying the "debugging" frontend to the production servers, and makes it easy to host the frontend on Heroku.
2017-11-29 17:59:01 -05:00
Paul Melnikow
4b5bf03fea Rewrite frontend in React (#1273)
I rewrote the frontend in React using a module bundler. It's matched feature-for-feature with the current frontend, with only slight changes in the styling. I did not fuss about making the styling identical; the badge popup looks particularly different.

This makes the front end much easier to develop. I'm really looking forward to implementing #701, to which this paves the way.

This makes light use of Next.js, which provides webpack config and dev/build tooling. We’ll probably replace it with create-react-app or our own webpack setup because unfortunately it comes with a lot of runtime overhead (the build is 400k).

Let’s open new issues for bugs and features, and track other follow-ups here: https://github.com/badges/shields/projects/1
2017-11-28 11:34:17 -05:00
tooomm
9e864f1660 fix "flat-square" style badge example 2017-11-10 13:10:37 -05:00
Danial
ab9be32f35 Update Homepage - Styles & Badge Size (#1242)
* Add social & for-the-badge to dropdown list

* badge minimum height 20px
2017-11-09 11:51:14 +13:00
Paul Melnikow
a2f5cbb03a Push frontend to production servers at /index.html (#1222)
* Push frontend to production servers at /index.html

Local production builds will use local server instead of img.shields.io, to support local testing

* Restore https://img.shields.io to example URIs
2017-11-01 20:48:01 +01:00
Danial
ebcfb105a0 [badge/dynamic/json] User defined JSON source badge (#820)
* Add User Defined URL support

* Add test

* eslint fixes

* 100% coverage

* use JSONpath

* update try.html

* Update tests, restore prefix & suffix

* order dependencies alphabetically

* update jsonpath version dependency

* update url structure & move to query strings

* update error handling & remove xml refrences

* fix eslint errors

* update tests

* update dynamic badge generator

* url -> uri & decode uri

Allow an encoded url to be used.
needed for any uri that requires params in the address

* resolve conflicts

* update for new page generation

* check uri is defined

* add query params to `request-handler.js`

* eslint fixes

* add test for no uri specified

* move query params to be local to dynamic badge

* update tests

* dynamic badge gen use same base url as static badge
2017-11-01 17:02:37 +13:00
Paul Melnikow
9f918dbee1 Use destructuring 2017-10-28 14:32:11 -04:00
Paul Melnikow
bde4d925f2 Retire try.html and create new dev + prod builds (#1194)
- Followup from #1163
- Retire try.html
- Separate build config for dev and production
    - Move config for badge examples into the JS build
- Move the prod transform into npm scripts
    - In the future this could be handled using a bundler plugin
- make website builds production build as before
- Run the production build in CI to make sure it’s working
- Build the frontend on Heroku
2017-10-28 14:02:45 -04:00
Paul Melnikow
a3b5dcbee8 Fix more badge links in the production build 2017-10-22 09:42:49 -04:00
Paul Melnikow
b411f08ad1 Generate badge examples from data + code (#1163)
This pull request sets us up to generate the badge examples dynamically from data and code.

Right now, try.html is still checked in, mostly for the benefit of reading this diff, though it should be removed on the next pass to avoid unnecessary complexity at merge time.
2017-10-20 17:33:12 -04:00