Skip to content
Permalink
Browse files

Initial commit to open source Segment Challenge.

  • Loading branch information...
slashdotdash committed May 3, 2019
0 parents commit d55e513c6ffb89dc4e7a6ce52cff366719b68792
Showing 749 changed files with 77,710 additions and 0 deletions.
@@ -0,0 +1,6 @@
# Used by "mix format"
[
import_deps: [:commanded, :phoenix],
inputs: ["*.{ex,exs}", "{config,lib,priv,test}/**/*.{ex,exs}"],
locals_without_parens: [project: 2, project: 3]
]
@@ -0,0 +1,14 @@
/_build
/cover
/deps
erl_crash.dump
*.ez

/config/*.secret.exs
/fixture/vcr_cassettes
/node_modules
/priv/static

.DS_Store
erl_crash.dump
repl-temp-*
@@ -0,0 +1 @@
elixir 1.8.1-otp-21
@@ -0,0 +1,62 @@
# Segment Challenge

Segment Challenge is an Elixir Phoenix web application built using [Commanded](https://github.com/commanded/commanded) for CQRS/ES. The front-end is mostly server generated HTML plus a few React components for responsive forms.

## Prerequisites

Install Elixir v1.8 and a Postgres database.

You will need to create a [Strava API Application](https://strava.com/settings/api) to access the API. Any Strava account can be used to create an application. Please refer to the [Strava Developers](http://developers.strava.com/) documentation for help.

## Getting started

1. Install Elixir dependencies:

```console
mix deps.get
```

2. Configure your Strava API Application settings:

```console
cp config/dev.secret.example config/dev.secret.exs
```

Edit the `config/dev.secret.exs` config file and enter the Client ID, Client Secret, and Access Token values from you [Strava API Application](https://strava.com/settings/api) settings.

You will need to do the same for `test.secret.exs` to run tests and `prod.secret.exs` to run in production.

3. Create the event store and read store databases:

```console
mix setup
```

This command will create and initialise two databases (`segmentchallenge_eventstore_dev` and `segmentchallenge_readstore_dev`) using the default Postgres connection settings configured in `config/dev.exs`.

4. Install JavaScript dependencies and compile assets:

```console
npm install
npm run compile
```

You can use the `npm run watch` task to watch the assets and recompile on change.

4. Run the Phoenix web server:

```console
iex -S mix phx.server
```

---

## Useful tasks

### Import active challenge stage efforts

Attempts at active stages are fetched from Strava every four hours. To import them immediately you can run the following from an `iex -S mix` console:

```elixir
iex> SegmentChallenge.Tasks.ImportActiveStageEfforts.execute()
```
@@ -0,0 +1,311 @@
@import "bulma/sass/utilities/initial-variables";

$white: #fff;
$orange: #FC4C02; // Strava orange
$black: #333333;
$blue: #007FB6;
$grey: #ccc;
// $grey-darker: #4a4a4a;
$grey-light: #e5e5e5;
$grey-lighter: #f5f5f5;

$family-sans-serif: "Helvetica Neue",Helvetica,Arial,sans-serif;
$family-primary: $family-sans-serif;

$primary: $orange;

$body-background: $grey-lighter;
$highlight: #FEEEE7;

$size-1: 2.5rem;
$size-2: 2rem;
$size-3: 1.75rem;
$size-4: 1.5rem;
$size-5: 1.1rem;
$size-6: 0.9rem;
$size-7: 0.75rem;

@import "bulma/bulma";
@import "bulma-divider/divider";
@import "bulma-ribbon/ribbon";
@import "bulma-steps/steps";
@import "bulma-pricingtable/src/sass/index";

@import "unpoly/dist/unpoly";

@import "badge";
@import "branding";
@import "container";
@import "flatpickr";
@import "form";
@import "heatmap";
@import "home";
@import "leaderboard";
@import "leaflet";
@import "map";
@import "print";
@import "stage";
@import "table";
@import "toggle";

.is-hidden {
display: none !important;
}

// Phoenix flash messages
.alert:empty { display: none; }

.title,
.subtitle,
h1, h2, h3, h4, h5, h6 {
font-weight: 300 !important;
}

.is-viewport {
min-height: 90vh;
background: $white;
}

footer.footer {
background: $grey-lighter;
padding-bottom: 20px;
color: $grey-dark;

.menu-list {
a:hover {
border-bottom: none;
}
}
}

.navbar-dropdown {
font-size: 1rem;
border-radius: 0;
}

// /* Phoenix inline forms in links and buttons */
form.link, form.button {
display: inline;
}

.is-login-button {
padding: 0;

img {
max-height: 48px;
margin-top: 5px;
}
}

.header-logo {
margin-top: 0px;
}

a.is-unobtrusive,
section .container a.is-unobtrusive {
color: $grey-darker;

&:visited {
color: $grey-darker;
}

&:hover {
color: $blue;
}
}

.column > .card {
box-shadow: none;
width: 100%;
}

.column {
&.is-action {
text-align: center;
}
}

span {
&.is-primary {
color: $primary;
}
}

.column {
&.is-bordered {
border-bottom: solid 1px $grey;
}
}

.content {
.is-divider {
color: $grey;
padding-top: 2px;
text-transform: uppercase;

&:after {
color: $grey;
}
}
}

div.is-separated {
border-top: solid 1px $grey-lighter;
border-bottom: solid 1px $grey-lighter;
padding: 1rem 0;
margin: 1rem 0;
}

div.is-separated-bottom {
border-bottom: solid 1px $grey-lighter;
padding-bottom: 1rem;
margin-bottom: 1rem;
}

div.is-separated-top {
border-bottom: solid 1px $grey-lighter;
padding-top: 1rem;
margin-top: 1rem;
}

section .container .is-unstyled-link a {
color: $black;
}

@media screen and (min-width: 769px) {
.is-bordered {
.columns {
&:first-child {
.column {
&.is-bordered {
border-top: solid 1px $grey;
}
}
}
}
}

.column {
&.is-action {
text-align: right;
}

&.is-bordered {
border: solid 1px $grey;
border-top: none;
border-left: none;

&:first-child {
border-left: solid 1px $grey;
}
}

&.is-bordered-left {
background-color: $white;
margin: 1em;

&.is-primary {
border-left: solid 5px $primary;
}

&.is-info {
border-left: solid 5px $info;
}
}
}
}

.is-avatar {
border-radius: 50%;
background-color: #f5f5f5;
}

.is-activity-feed {
figure {
margin: 1em;
}

.content {
margin: 1.8em 1em 1em 1em;
}
}

.is-selectable {
cursor: pointer;

&.is-active {
background-color: $grey-lighter;
}
}

.is-vcentered {
margin: 5vh 0 5vh 0 !important;

}

@media screen and (min-width: 769px) {
.is-vcentered {
margin: 20vh 0 30vh 0 !important;
}
}

.has-vertically-aligned-content {
display: flex;
flex-direction: column;
justify-content: center;
}

.has-bottom-aligned-content {
display: flex;
flex-direction: column;
justify-content: end;
}

.is-scrollable-content {
max-height: 400px;
overflow-y: auto;
padding: 5px 20px 10px 5px;
}

textarea,
.textarea {
min-height: inherit;
height: auto;
}

.pricing-table .pricing-plan .plan-item {
text-align: left;
color: $black;
}

.dropdown-title {
color: $grey;
font-size: .75em;
letter-spacing: .1em;
text-transform: uppercase;
}

.tabs {
&.is-toggle {
li.is-active {
&.is-light {
a {
background-color: $grey;
border-color: $grey;
}
}
}
}
}

#doorbell-button {
display: block;
position: relative;
top: -35px;
right: inherit;
left: 35px;
background-color: $primary;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}

0 comments on commit d55e513

Please sign in to comment.
You can’t perform that action at this time.