-
Notifications
You must be signed in to change notification settings - Fork 331
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f5b958f
commit d0dff77
Showing
12 changed files
with
187 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,3 +27,5 @@ package-lock.json | |
|
||
src/shared/translations | ||
|
||
stats.json | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
src/shared/translations | ||
lemmy-translations | ||
src/assets/css/themes/*.css | ||
stats.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,39 @@ | ||
import { initializeSite } from "@utils/app"; | ||
import setDefaultOptions from "date-fns/setDefaultOptions"; | ||
import { hydrate } from "inferno-hydrate"; | ||
import { Router } from "inferno-router"; | ||
import { App } from "../shared/components/app/app"; | ||
import { HistoryService } from "../shared/services"; | ||
import { HistoryService, I18NextService } from "../shared/services"; | ||
|
||
import "bootstrap/js/dist/collapse"; | ||
import "bootstrap/js/dist/dropdown"; | ||
|
||
initializeSite(window.isoData.site_res); | ||
async function startClient() { | ||
initializeSite(window.isoData.site_res); | ||
|
||
const wrapper = ( | ||
<Router history={HistoryService.history}> | ||
<App /> | ||
</Router> | ||
); | ||
const lang = I18NextService.i18n.language; | ||
const locale = ( | ||
await import( | ||
/* webpackExclude: /\.js\.flow$/ */ | ||
`date-fns/locale/${lang}` | ||
) | ||
).default; | ||
|
||
const root = document.getElementById("root"); | ||
setDefaultOptions({ | ||
locale, | ||
}); | ||
|
||
if (root) { | ||
hydrate(wrapper, root); | ||
const wrapper = ( | ||
<Router history={HistoryService.history}> | ||
<App /> | ||
</Router> | ||
); | ||
|
||
const root = document.getElementById("root"); | ||
|
||
if (root) { | ||
hydrate(wrapper, root); | ||
} | ||
} | ||
|
||
startClient(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,13 @@ | ||
import moment from "moment"; | ||
|
||
moment.updateLocale("en", { | ||
relativeTime: { | ||
future: "in %s", | ||
past: "%s ago", | ||
s: "<1m", | ||
ss: "%ds", | ||
m: "1m", | ||
mm: "%dm", | ||
h: "1h", | ||
hh: "%dh", | ||
d: "1d", | ||
dd: "%dd", | ||
w: "1w", | ||
ww: "%dw", | ||
M: "1M", | ||
MM: "%dM", | ||
y: "1Y", | ||
yy: "%dY", | ||
}, | ||
}); | ||
import getDayOfYear from "date-fns/getDayOfYear"; | ||
import getYear from "date-fns/getYear"; | ||
import parseISO from "date-fns/parseISO"; | ||
|
||
export default function isCakeDay(published: string): boolean { | ||
const createDate = moment.utc(published).local(); | ||
const currentDate = moment(new Date()); | ||
const createDate = parseISO(published); | ||
const currentDate = new Date(); | ||
|
||
return ( | ||
createDate.date() === currentDate.date() && | ||
createDate.month() === currentDate.month() && | ||
createDate.year() !== currentDate.year() | ||
getDayOfYear(createDate) === getDayOfYear(currentDate) && | ||
getYear(createDate) !== getYear(currentDate) | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.