Skip to content

armgit / fider

Public Imported from GitHub
0

Open platform to collect and prioritize feedback

chore: add Fider version and OpenCollective (#369)

Guilherme Oenning34dfbeed98bf
diff --git a/app/pkg/web/renderer.go b/app/pkg/web/renderer.go
index 924bd5f70..ccc39250a 100644
--- a/app/pkg/web/renderer.go
+++ b/app/pkg/web/renderer.go
@@ -87,9 +87,9 @@ func (r *Renderer) Render(w io.Writer, name string, data interface{}, ctx *Conte
m := data.(Map)
m["__JavaScriptBundle"] = r.jsBundle
m["__StyleBundle"] = r.cssBundle
+ m["__ContextID"] = ctx.ContextID()
+
m["system"] = r.settings
-
- m["contextID"] = ctx.ContextID()
m["baseURL"] = ctx.BaseURL()
m["tenant"] = ctx.Tenant()
m["auth"] = Map{
diff --git a/public/assets/styles/main.scss b/public/assets/styles/main.scss
index f43320e14..6a2582100 100644
--- a/public/assets/styles/main.scss
+++ b/public/assets/styles/main.scss
@@ -70,6 +70,10 @@ body, h1, h2, h3, h4, h5, .ui, input {
color: rgba(0,0,0,.6);
}
+.center {
+ text-align: center;
+}
+
.info.right {
float: right;
}
@@ -298,4 +302,10 @@ code {
.c-toast {
border-radius: 5px !important;
+}
+
+.desktop-only {
+ @include media("<desktop") {
+ display: none;
+ }
}
\ No newline at end of file
diff --git a/public/assets/styles/variables.scss b/public/assets/styles/variables.scss
index 71290bec2..9dc5dd6f7 100644
--- a/public/assets/styles/variables.scss
+++ b/public/assets/styles/variables.scss
@@ -23,23 +23,33 @@ $red: #db2828;
// Queries
$tablet-width: 768px;
-$desktop-width: 1024px;
+$desktop-width: 992px;
-@mixin mobile {
- @media (max-width: #{$tablet-width - 0.1px}) {
- @content;
+@mixin media($media) {
+ @if $media == "phone" {
+ @media only screen and (max-width: #{$tablet-width - 0.1px}) {
+ @content;
+ }
}
-}
-
-@mixin tablet {
- @media (min-width: #{$tablet-width}) {
- @content;
+ @else if $media == "tablet" {
+ @media only screen and (min-width: #{$tablet-width}) and (max-width: #{$desktop-width - 0.1px}) {
+ @content;
+ }
}
-}
-
-@mixin desktop {
- @media (min-width: #{$desktop-width}) {
- @content;
+ @else if $media == ">tablet" {
+ @media only screen and (min-width: #{$tablet-width}) {
+ @content;
+ }
+ }
+ @else if $media == "<desktop" {
+ @media only screen and (max-width: #{$desktop-width - 0.1px}) {
+ @content;
+ }
+ }
+ @else if $media == "desktop" {
+ @media only screen and (min-width: #{$desktop-width}) {
+ @content;
+ }
}
}
diff --git a/public/components/common/FiderVersion.tsx b/public/components/common/FiderVersion.tsx
new file mode 100644
index 000000000..7acb08d0e
--- /dev/null
+++ b/public/components/common/FiderVersion.tsx
@@ -0,0 +1,15 @@
+import * as React from "react";
+import { page } from "@fider/services";
+
+export const FiderVersion = () => {
+ return (
+ <p className="info center desktop-only">
+ Support our{" "}
+ <a target="_blank" href="http://opencollective.com/fider">
+ OpenCollective
+ </a>
+ <br />
+ Fider v{page.systemSettings().version}
+ </p>
+ );
+};
diff --git a/public/components/common/Modal.scss b/public/components/common/Modal.scss
index 897cc14fc..d438f11bd 100644
--- a/public/components/common/Modal.scss
+++ b/public/components/common/Modal.scss
@@ -33,13 +33,13 @@
width: 100%;
&.small {
- @include tablet {
+ @include media(">tablet") {
width: 500px;
}
}
&.large {
- @include tablet {
+ @include media(">tablet") {
width: 750px;
}
}
diff --git a/public/components/common/index.tsx b/public/components/common/index.tsx
index d0749fbf1..4ed6e6f5d 100644
--- a/public/components/common/index.tsx
+++ b/public/components/common/index.tsx
@@ -13,6 +13,7 @@ export * from "./UserName";
export * from "./Modal";
export * from "./Loader";
export * from "./Toggle";
+export * from "./FiderVersion";
import Textarea from "react-textarea-autosize";
export { Textarea };
diff --git a/public/pages/Administration/components/SideMenu.tsx b/public/pages/Administration/components/SideMenu.tsx
index 11160740c..31ac49e14 100644
--- a/public/pages/Administration/components/SideMenu.tsx
+++ b/public/pages/Administration/components/SideMenu.tsx
@@ -1,6 +1,7 @@
import * as React from "react";
import { CurrentUser } from "@fider/models";
-import { classSet } from "@fider/services";
+import { classSet, page } from "@fider/services";
+import { FiderVersion } from "@fider/components";
interface SiteMenuProps {
activeItem: string;
@@ -38,20 +39,23 @@ const SideMenuItem = (props: SideMenuItemProps) => {
export const SideMenu = (props: SiteMenuProps) => {
const activeItem = props.activeItem || "general";
return (
- <div className="ui vertical menu fluid">
- <SideMenuItem name="general" title="General" href="/admin" isActive={activeItem === "general"} />
- <SideMenuItem name="privacy" title="Privacy" href="/admin/privacy" isActive={activeItem === "privacy"} />
- <SideMenuItem name="members" title="Members" href="/admin/members" isActive={activeItem === "members"} />
- <SideMenuItem name="tags" title="Tags" href="/admin/tags" isActive={activeItem === "tags"} />
- <SideMenuItem
- name="invitations"
- title="Invitations"
- href="/admin/invitations"
- isActive={activeItem === "invitations"}
- />
- {props.user.isAdministrator && (
- <SideMenuItem name="export" title="Export" href="/admin/export" isActive={activeItem === "export"} />
- )}
- </div>
+ <>
+ <div className="ui vertical menu fluid">
+ <SideMenuItem name="general" title="General" href="/admin" isActive={activeItem === "general"} />
+ <SideMenuItem name="privacy" title="Privacy" href="/admin/privacy" isActive={activeItem === "privacy"} />
+ <SideMenuItem name="members" title="Members" href="/admin/members" isActive={activeItem === "members"} />
+ <SideMenuItem name="tags" title="Tags" href="/admin/tags" isActive={activeItem === "tags"} />
+ <SideMenuItem
+ name="invitations"
+ title="Invitations"
+ href="/admin/invitations"
+ isActive={activeItem === "invitations"}
+ />
+ {props.user.isAdministrator && (
+ <SideMenuItem name="export" title="Export" href="/admin/export" isActive={activeItem === "export"} />
+ )}
+ </div>
+ <FiderVersion />
+ </>
);
};
diff --git a/public/pages/Home/Home.page.scss b/public/pages/Home/Home.page.scss
index 5a5b60492..70957957d 100644
--- a/public/pages/Home/Home.page.scss
+++ b/public/pages/Home/Home.page.scss
@@ -62,7 +62,7 @@
}
}
- @include mobile {
+ @include media("phone") {
.filter-column {
padding-right: 0;
}
diff --git a/public/pages/ShowIdea/ShowIdea.page.scss b/public/pages/ShowIdea/ShowIdea.page.scss
index 3fd7105bd..e6ffd5ffc 100644
--- a/public/pages/ShowIdea/ShowIdea.page.scss
+++ b/public/pages/ShowIdea/ShowIdea.page.scss
@@ -18,7 +18,7 @@
}
}
- @include tablet {
+ @include media(">tablet") {
.header-col,
.comments-col {
float: left;
@@ -34,7 +34,7 @@
}
.action-col {
- @include tablet {
+ @include media(">tablet") {
width: 200px;
}
.ui.list {
diff --git a/public/services/page.ts b/public/services/page.ts
index 263a564d1..fca424c3a 100644
--- a/public/services/page.ts
+++ b/public/services/page.ts
@@ -1,4 +1,4 @@
-import { AuthSettings } from "@fider/models";
+import { AuthSettings, SystemSettings } from "@fider/models";
export const goHome = (): void => {
document.location.href = "/";
@@ -24,6 +24,10 @@ export const authSettings = (): AuthSettings => {
return (window as any).props.auth;
};
+export const systemSettings = (): SystemSettings => {
+ return (window as any).props.system;
+};
+
export interface ModalOptions {
closable: boolean;
}
diff --git a/views/base.html b/views/base.html
index 810b46329..7d936a136 100644
--- a/views/base.html
+++ b/views/base.html
@@ -23,7 +23,7 @@
</noscript>
{{ if ne .system.GoogleAnalytics "" }}
- <script type="text/javascript" nonce="{{ .contextID }}">
+ <script type="text/javascript" nonce="{{ .__ContextID }}">
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
@@ -39,7 +39,7 @@
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=default,fetch"></script>
<script src="/assets/js/{{ .__JavaScriptBundle }}"></script>
- <script type="text/javascript" nonce="{{ .contextID }}">
+ <script type="text/javascript" nonce="{{ .__ContextID }}">
{{template "javascript" .}}
</script>
</body>