diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 00000000..65edaef9 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +github: [Lattyware] diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md new file mode 100644 index 00000000..9e648c06 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-report.md @@ -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. + diff --git a/.github/ISSUE_TEMPLATE/feature-request.md b/.github/ISSUE_TEMPLATE/feature-request.md new file mode 100644 index 00000000..72748f45 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature-request.md @@ -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. + diff --git a/client/src/elm/MassiveDecks/Card/Source/ManyDecks.elm b/client/src/elm/MassiveDecks/Card/Source/ManyDecks.elm index da3cc898..a04856eb 100644 --- a/client/src/elm/MassiveDecks/Card/Source/ManyDecks.elm +++ b/client/src/elm/MassiveDecks/Card/Source/ManyDecks.elm @@ -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 diff --git a/client/src/elm/MassiveDecks/Error.elm b/client/src/elm/MassiveDecks/Error.elm index 013254a8..2aa8d1b1 100644 --- a/client/src/elm/MassiveDecks/Error.elm +++ b/client/src/elm/MassiveDecks/Error.elm @@ -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 diff --git a/client/src/elm/MassiveDecks/Pages/Start.elm b/client/src/elm/MassiveDecks/Pages/Start.elm index f38c6f24..b0eb7085 100644 --- a/client/src/elm/MassiveDecks/Pages/Start.elm +++ b/client/src/elm/MassiveDecks/Pages/Start.elm @@ -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 ] diff --git a/client/src/elm/MassiveDecks/Settings.elm b/client/src/elm/MassiveDecks/Settings.elm index 51ce7a9a..e8a5a28d 100644 --- a/client/src/elm/MassiveDecks/Settings.elm +++ b/client/src/elm/MassiveDecks/Settings.elm @@ -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 diff --git a/client/src/elm/MassiveDecks/Strings/Languages.elm b/client/src/elm/MassiveDecks/Strings/Languages.elm index 4f99c3b9..48f8e0d8 100644 --- a/client/src/elm/MassiveDecks/Strings/Languages.elm +++ b/client/src/elm/MassiveDecks/Strings/Languages.elm @@ -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`. diff --git a/client/src/elm/MassiveDecks/Strings/Render.elm b/client/src/elm/MassiveDecks/Strings/Render.elm index d992cb43..a3872def 100644 --- a/client/src/elm/MassiveDecks/Strings/Render.elm +++ b/client/src/elm/MassiveDecks/Strings/Render.elm @@ -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 diff --git a/client/src/scss/_colors.scss b/client/src/scss/_colors.scss index 31f5e3ab..ebbc2f8d 100644 --- a/client/src/scss/_colors.scss +++ b/client/src/scss/_colors.scss @@ -24,3 +24,5 @@ $secondary-background: #cccccc; $transparent: rgba(#ffffff, 0); $card: #ffffff; + +$many-decks: #00796b; diff --git a/client/src/scss/cards/_sources.scss b/client/src/scss/cards/_sources.scss index 483e7359..3fb9110f 100644 --- a/client/src/scss/cards/_sources.scss +++ b/client/src/scss/cards/_sources.scss @@ -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; diff --git a/client/src/scss/pages/_start.scss b/client/src/scss/pages/_start.scss index 523b9ea0..e3d0bd31 100644 --- a/client/src/scss/pages/_start.scss +++ b/client/src/scss/pages/_start.scss @@ -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; + } +} diff --git a/server/decks/cah-base-en.deck.json5 b/server/decks/cah-base-en.deck.json5 index f20a0699..1be13424 100644 --- a/server/decks/cah-base-en.deck.json5 +++ b/server/decks/cah-base-en.deck.json5 @@ -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", diff --git a/server/src/ts/config.ts b/server/src/ts/config.ts index 2cf5b08b..a7f39697 100644 --- a/server/src/ts/config.ts +++ b/server/src/ts/config.ts @@ -148,6 +148,9 @@ const parseManyDecks = ( manyDecks: BaseManyDecks ): ManyDecks => ({ ...manyDecks, + baseUrl: manyDecks.baseUrl.endsWith("/") + ? manyDecks.baseUrl + : manyDecks.baseUrl + "/", timeout: parseDuration(manyDecks.timeout), }); diff --git a/server/src/ts/games/cards/sources/many-decks.ts b/server/src/ts/games/cards/sources/many-decks.ts index b3bc0548..f7e95eb1 100644 --- a/server/src/ts/games/cards/sources/many-decks.ts +++ b/server/src/ts/games/cards/sources/many-decks.ts @@ -25,14 +25,17 @@ export interface ClientInfo { export class Resolver extends Source.Resolver { public readonly source: ManyDecks; + private readonly config: Config.ManyDecks; private readonly connectionPool: genericPool.Pool; public constructor( source: ManyDecks, + config: Config.ManyDecks, connectionPool: genericPool.Pool ) { super(); this.source = source; + this.config = config; this.connectionPool = connectionPool; } @@ -80,6 +83,7 @@ export class Resolver extends Source.Resolver { 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 { timeout: config.timeout, responseType: "json", }; - console.log(JSON.stringify(httpConfig)); this.connectionPool = genericPool.createPool( { @@ -161,7 +164,7 @@ export class MetaResolver implements Source.MetaResolver { } resolver(source: ManyDecks): Resolver { - return new Resolver(source, this.connectionPool); + return new Resolver(source, this.config, this.connectionPool); } }