Skip to content

Commit 1bc4f07

Browse files
committed
Add pointer to many decks.
1 parent cd591c4 commit 1bc4f07

File tree

15 files changed

+115
-18
lines changed

15 files changed

+115
-18
lines changed

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: [Lattyware]

.github/ISSUE_TEMPLATE/bug-report.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
name: Bug Report
3+
about: Create a report to help us fix a problem.
4+
title: ''
5+
labels: bug
6+
assignees: ''
7+
---
8+
9+
## Describe the bug
10+
A clear and concise description of what the bug is.
11+
Please copy and paste or screenshot any error you received.
12+
13+
14+
## How to reproduce the bug
15+
Steps to reproduce the behaviour:
16+
1. Start a new game
17+
2. Enable a particular setting
18+
3.
19+
20+
21+
### Expected behaviour
22+
A clear and concise description of what you expected to happen.
23+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
name: Feature Request
3+
about: Ask us to add a new feature.
4+
title: ''
5+
labels: enhancement
6+
assignees: ''
7+
---
8+
9+
## Describe the feature
10+
A clear and concise description of what the feature you would like is.
11+

client/src/elm/MassiveDecks/Card/Source/ManyDecks.elm

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import Html as Html exposing (Html)
99
import Html.Attributes as HtmlA
1010
import Html.Events as HtmlE
1111
import Json.Decode as Json
12-
import MassiveDecks.Card.Source.ManyDecks.Model exposing (DeckCode, deckCode, toString)
12+
import MassiveDecks.Card.Source.ManyDecks.Model as ManyDecks exposing (..)
1313
import MassiveDecks.Card.Source.Methods as Source
1414
import MassiveDecks.Card.Source.Model as Source exposing (Source)
1515
import MassiveDecks.Components.Form.Message as Message exposing (Message)
@@ -19,6 +19,7 @@ import MassiveDecks.Strings as Strings exposing (MdString)
1919
import MassiveDecks.Strings.Languages as Lang
2020
import MassiveDecks.Util.Maybe as Maybe
2121
import Material.TextField as TextField
22+
import Url.Builder as Url
2223

2324

2425
methods : DeckCode -> Source.ExternalMethods msg
@@ -125,8 +126,12 @@ editor dc shared existing update submit noOp =
125126

126127
details : DeckCode -> Shared -> Source.Details
127128
details dc shared =
129+
let
130+
url baseUrl =
131+
Url.crossOrigin baseUrl [ "decks", dc |> toString ] []
132+
in
128133
{ name = (() |> name |> Lang.string shared) ++ " " ++ (dc |> toString)
129-
, url = Nothing
134+
, url = shared.sources.manyDecks |> Maybe.map (.baseUrl >> url)
130135
, author = Nothing
131136
, translator = Nothing
132137
, language = Nothing

client/src/elm/MassiveDecks/Error.elm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ body shared route description details =
9393
++ "\n\tPage: "
9494
++ Route.externalUrl shared.origin route
9595
++ "\n\tEnglish Error: "
96-
++ Lang.givenLanguageString Lang.En description
96+
++ Lang.givenLanguageString shared Lang.En description
9797
++ "\n\tDetails: "
9898
++ details
9999
in

client/src/elm/MassiveDecks/Pages/Start.elm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,11 @@ view shared model =
197197
let
198198
r =
199199
model.route
200+
201+
manyDecksAd { baseUrl } =
202+
Html.blankA
203+
[ HtmlA.href baseUrl, HtmlA.id "many-decks-ad", Strings.ManyDecksWhereToGet |> Lang.title shared ]
204+
[ Html.div [] [ Icon.boxOpen |> Icon.viewIcon, Strings.ManyDecks |> Lang.html shared ] ]
200205
in
201206
[ Html.div [ HtmlA.class "page start" ]
202207
[ overlay shared model.overlay
@@ -241,6 +246,7 @@ view shared model =
241246
]
242247
]
243248
]
249+
, shared.sources.manyDecks |> Maybe.map manyDecksAd |> Maybe.withDefault Html.nothing
244250
]
245251

246252

client/src/elm/MassiveDecks/Settings.elm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -555,12 +555,12 @@ languageOption shared currentLanguage language =
555555
nameInCurrentLanguage =
556556
language
557557
|> Lang.languageName
558-
|> Lang.givenLanguageString currentLanguage
558+
|> Lang.givenLanguageString shared currentLanguage
559559

560560
autonym =
561561
if language /= currentLanguage then
562562
language
563-
|> Lang.autonym
563+
|> Lang.autonym shared
564564
|> (\n -> Just [ Strings.AutonymFormat { autonym = n } |> Lang.html shared ])
565565

566566
else

client/src/elm/MassiveDecks/Strings/Languages.elm

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ languageName language =
7070

7171
{-| The given language's name for itself.
7272
-}
73-
autonym : Language -> String
74-
autonym language =
75-
languageName language |> givenLanguageString language
73+
autonym : Shared -> Language -> String
74+
autonym shared language =
75+
languageName language |> givenLanguageString shared language
7676

7777

7878
{-| A sort that gives the closest matches first.
@@ -119,14 +119,14 @@ findBestMatch codes =
119119
-}
120120
string : Shared -> MdString -> String
121121
string shared mdString =
122-
mdString |> givenLanguageString (currentLanguage shared)
122+
mdString |> givenLanguageString shared (currentLanguage shared)
123123

124124

125125
{-| Build an actual string in the given language.
126126
-}
127-
givenLanguageString : Language -> MdString -> String
128-
givenLanguageString lang mdString =
129-
mdString |> Render.asString { lang = lang, translate = translate lang, parent = mdString }
127+
givenLanguageString : Shared -> Language -> MdString -> String
128+
givenLanguageString shared lang mdString =
129+
mdString |> Render.asString { lang = lang, translate = translate lang, parent = mdString, shared = shared }
130130

131131

132132
{-| 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 =
138138
lang =
139139
currentLanguage shared
140140
in
141-
mdString |> Render.asHtml { lang = lang, translate = translate lang, parent = mdString }
141+
mdString |> Render.asHtml { lang = lang, translate = translate lang, parent = mdString, shared = shared }
142142

143143

144144
{-| Convenience for an HTML `title` attribute from the given `MdString`.

client/src/elm/MassiveDecks/Strings/Render.elm

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ import FontAwesome.Icon as Icon exposing (Icon)
44
import FontAwesome.Solid as Icon
55
import Html as Html exposing (Html)
66
import Html.Attributes as HtmlA
7+
import MassiveDecks.Card.Source.Model as Source
78
import MassiveDecks.Icon as Icon
9+
import MassiveDecks.Model exposing (Shared)
810
import MassiveDecks.Strings as Strings exposing (..)
911
import MassiveDecks.Strings.Languages.En as En
1012
import MassiveDecks.Strings.Languages.Model exposing (Language)
@@ -16,6 +18,7 @@ type alias Context =
1618
{ lang : Language
1719
, translate : MdString -> List Translation.Result
1820
, parent : MdString
21+
, shared : Shared
1922
}
2023

2124

@@ -237,7 +240,12 @@ enhanceHtml context mdString unenhanced =
237240
term context PlayedDescription Icon.check unenhanced
238241

239242
ManyDecksWhereToGet ->
240-
[ Html.blankA [ HtmlA.href "https://decks.md.rereadgames.com/" ] unenhanced ]
243+
case context.shared.sources.manyDecks of
244+
Just { baseUrl } ->
245+
[ Html.blankA [ HtmlA.href baseUrl ] unenhanced ]
246+
247+
Nothing ->
248+
unenhanced
241249

242250
_ ->
243251
unenhanced

client/src/scss/_colors.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,5 @@ $secondary-background: #cccccc;
2424
$transparent: rgba(#ffffff, 0);
2525

2626
$card: #ffffff;
27+
28+
$many-decks: #00796b;

0 commit comments

Comments
 (0)