Add pointer to many decks.

This commit is contained in:
Gareth Latty
2020-05-23 18:11:08 +01:00
parent cd591c4af1
commit 1bc4f074ed
15 changed files with 115 additions and 18 deletions
+1
View File
@@ -0,0 +1 @@
github: [Lattyware]
+23
View File
@@ -0,0 +1,23 @@
---
name: Bug Report
about: Create a report to help us fix a problem.
title: ''
labels: bug
assignees: ''
---
## Describe the bug
A clear and concise description of what the bug is.
Please copy and paste or screenshot any error you received.
## How to reproduce the bug
Steps to reproduce the behaviour:
1. Start a new game
2. Enable a particular setting
3.
### Expected behaviour
A clear and concise description of what you expected to happen.
+11
View File
@@ -0,0 +1,11 @@
---
name: Feature Request
about: Ask us to add a new feature.
title: ''
labels: enhancement
assignees: ''
---
## Describe the feature
A clear and concise description of what the feature you would like is.
@@ -9,7 +9,7 @@ import Html as Html exposing (Html)
import Html.Attributes as HtmlA
import Html.Events as HtmlE
import Json.Decode as Json
import MassiveDecks.Card.Source.ManyDecks.Model exposing (DeckCode, deckCode, toString)
import MassiveDecks.Card.Source.ManyDecks.Model as ManyDecks exposing (..)
import MassiveDecks.Card.Source.Methods as Source
import MassiveDecks.Card.Source.Model as Source exposing (Source)
import MassiveDecks.Components.Form.Message as Message exposing (Message)
@@ -19,6 +19,7 @@ import MassiveDecks.Strings as Strings exposing (MdString)
import MassiveDecks.Strings.Languages as Lang
import MassiveDecks.Util.Maybe as Maybe
import Material.TextField as TextField
import Url.Builder as Url
methods : DeckCode -> Source.ExternalMethods msg
@@ -125,8 +126,12 @@ editor dc shared existing update submit noOp =
details : DeckCode -> Shared -> Source.Details
details dc shared =
let
url baseUrl =
Url.crossOrigin baseUrl [ "decks", dc |> toString ] []
in
{ name = (() |> name |> Lang.string shared) ++ " " ++ (dc |> toString)
, url = Nothing
, url = shared.sources.manyDecks |> Maybe.map (.baseUrl >> url)
, author = Nothing
, translator = Nothing
, language = Nothing
+1 -1
View File
@@ -93,7 +93,7 @@ body shared route description details =
++ "\n\tPage: "
++ Route.externalUrl shared.origin route
++ "\n\tEnglish Error: "
++ Lang.givenLanguageString Lang.En description
++ Lang.givenLanguageString shared Lang.En description
++ "\n\tDetails: "
++ details
in
@@ -197,6 +197,11 @@ view shared model =
let
r =
model.route
manyDecksAd { baseUrl } =
Html.blankA
[ HtmlA.href baseUrl, HtmlA.id "many-decks-ad", Strings.ManyDecksWhereToGet |> Lang.title shared ]
[ Html.div [] [ Icon.boxOpen |> Icon.viewIcon, Strings.ManyDecks |> Lang.html shared ] ]
in
[ Html.div [ HtmlA.class "page start" ]
[ overlay shared model.overlay
@@ -241,6 +246,7 @@ view shared model =
]
]
]
, shared.sources.manyDecks |> Maybe.map manyDecksAd |> Maybe.withDefault Html.nothing
]
+2 -2
View File
@@ -555,12 +555,12 @@ languageOption shared currentLanguage language =
nameInCurrentLanguage =
language
|> Lang.languageName
|> Lang.givenLanguageString currentLanguage
|> Lang.givenLanguageString shared currentLanguage
autonym =
if language /= currentLanguage then
language
|> Lang.autonym
|> Lang.autonym shared
|> (\n -> Just [ Strings.AutonymFormat { autonym = n } |> Lang.html shared ])
else
@@ -70,9 +70,9 @@ languageName language =
{-| The given language's name for itself.
-}
autonym : Language -> String
autonym language =
languageName language |> givenLanguageString language
autonym : Shared -> Language -> String
autonym shared language =
languageName language |> givenLanguageString shared language
{-| A sort that gives the closest matches first.
@@ -119,14 +119,14 @@ findBestMatch codes =
-}
string : Shared -> MdString -> String
string shared mdString =
mdString |> givenLanguageString (currentLanguage shared)
mdString |> givenLanguageString shared (currentLanguage shared)
{-| Build an actual string in the given language.
-}
givenLanguageString : Language -> MdString -> String
givenLanguageString lang mdString =
mdString |> Render.asString { lang = lang, translate = translate lang, parent = mdString }
givenLanguageString : Shared -> Language -> MdString -> String
givenLanguageString shared lang mdString =
mdString |> Render.asString { lang = lang, translate = translate lang, parent = mdString, shared = shared }
{-| An HTML text node from the given `MdString`. Note this is more than just convenience - we enhance some strings
@@ -138,7 +138,7 @@ html shared mdString =
lang =
currentLanguage shared
in
mdString |> Render.asHtml { lang = lang, translate = translate lang, parent = mdString }
mdString |> Render.asHtml { lang = lang, translate = translate lang, parent = mdString, shared = shared }
{-| Convenience for an HTML `title` attribute from the given `MdString`.
@@ -4,7 +4,9 @@ import FontAwesome.Icon as Icon exposing (Icon)
import FontAwesome.Solid as Icon
import Html as Html exposing (Html)
import Html.Attributes as HtmlA
import MassiveDecks.Card.Source.Model as Source
import MassiveDecks.Icon as Icon
import MassiveDecks.Model exposing (Shared)
import MassiveDecks.Strings as Strings exposing (..)
import MassiveDecks.Strings.Languages.En as En
import MassiveDecks.Strings.Languages.Model exposing (Language)
@@ -16,6 +18,7 @@ type alias Context =
{ lang : Language
, translate : MdString -> List Translation.Result
, parent : MdString
, shared : Shared
}
@@ -237,7 +240,12 @@ enhanceHtml context mdString unenhanced =
term context PlayedDescription Icon.check unenhanced
ManyDecksWhereToGet ->
[ Html.blankA [ HtmlA.href "https://decks.md.rereadgames.com/" ] unenhanced ]
case context.shared.sources.manyDecks of
Just { baseUrl } ->
[ Html.blankA [ HtmlA.href baseUrl ] unenhanced ]
Nothing ->
unenhanced
_ ->
unenhanced
+2
View File
@@ -24,3 +24,5 @@ $secondary-background: #cccccc;
$transparent: rgba(#ffffff, 0);
$card: #ffffff;
$many-decks: #00796b;
+3 -1
View File
@@ -1,6 +1,8 @@
@use "../_colors";
.many-decks-deck-code {
font-family: monospace;
background-color: #00796b;
background-color: colors.$many-decks;
color: #ffffff;
padding: 0.5em;
letter-spacing: 0.2em;
+33
View File
@@ -176,3 +176,36 @@
}
}
}
#many-decks-ad div {
position: fixed;
left: -0.8em;
top: -3em;
display: flex;
flex-direction: column-reverse;
align-items: center;
text-align: center;
justify-content: flex-start;
width: 7em;
height: 7em;
border-radius: 100%;
transition: left 0.25s, top 0.25s;
transform: rotate(-15deg);
font-size: 1.2em;
background-color: colors.$many-decks;
color: #ffffff;
> * {
margin-bottom: 0.5em;
}
&:hover {
left: -0.7em;
top: -2.5em;
}
}
+1 -1
View File
@@ -580,7 +580,7 @@
],
responses: [
"silence",
"the illusion of choice ina late-stage capitalist society",
"the illusion of choice in a late-stage capitalist society",
"many bats",
"famine",
"flesh-eating bacteria",
+3
View File
@@ -148,6 +148,9 @@ const parseManyDecks = (
manyDecks: BaseManyDecks<UnparsedDuration>
): ManyDecks => ({
...manyDecks,
baseUrl: manyDecks.baseUrl.endsWith("/")
? manyDecks.baseUrl
: manyDecks.baseUrl + "/",
timeout: parseDuration(manyDecks.timeout),
});
@@ -25,14 +25,17 @@ export interface ClientInfo {
export class Resolver extends Source.Resolver<ManyDecks> {
public readonly source: ManyDecks;
private readonly config: Config.ManyDecks;
private readonly connectionPool: genericPool.Pool<AxiosInstance>;
public constructor(
source: ManyDecks,
config: Config.ManyDecks,
connectionPool: genericPool.Pool<AxiosInstance>
) {
super();
this.source = source;
this.config = config;
this.connectionPool = connectionPool;
}
@@ -80,6 +83,7 @@ export class Resolver extends Source.Resolver<ManyDecks> {
const summary = {
details: {
name: data.name,
url: `${this.config.baseUrl}decks/${this.source.deckCode}`,
author: data.author,
translator: data.translator,
language: data.language,
@@ -137,7 +141,6 @@ export class MetaResolver implements Source.MetaResolver<ManyDecks> {
timeout: config.timeout,
responseType: "json",
};
console.log(JSON.stringify(httpConfig));
this.connectionPool = genericPool.createPool(
{
@@ -161,7 +164,7 @@ export class MetaResolver implements Source.MetaResolver<ManyDecks> {
}
resolver(source: ManyDecks): Resolver {
return new Resolver(source, this.connectionPool);
return new Resolver(source, this.config, this.connectionPool);
}
}