Skip to content

Commit

Permalink
remove migration script & test ad
Browse files Browse the repository at this point in the history
  • Loading branch information
pveyes committed Oct 24, 2023
1 parent 91fd717 commit e244a2d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 29 deletions.
8 changes: 8 additions & 0 deletions components/StatsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,14 @@ export default function StatsModal(props: Props) {
);
})}
</div>
<ins
className="adsbygoogle"
style={{ display: "block" }}
data-ad-client="ca-pub-3081263972680635"
data-ad-slot="2576511153"
data-ad-format="auto"
data-full-width-responsive="true"
/>
{showShare && (
<>
<WordDefinition answer={answer} />
Expand Down
5 changes: 5 additions & 0 deletions pages/_document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ export default function Document() {
<Html lang="id" translate="no">
<Head>
<meta name="google-adsense-account" content="ca-pub-3081263972680635" />
<script
async
src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3081263972680635"
crossOrigin="anonymous"
/>
</Head>
<body>
<Main />
Expand Down
31 changes: 2 additions & 29 deletions pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { ComponentProps, useEffect, useLayoutEffect } from "react";
import React, { ComponentProps, useEffect } from "react";
import { GetStaticProps } from "next";
import path from "path";
import fs from "fs/promises";
Expand All @@ -15,12 +15,7 @@ import HeadingWithNum from "../components/HeadingWithNum";
import { useModalState } from "../components/Modal";
import SponsorshipFooter from "../components/SponsorshipFooter";

import {
generateMigrationLink,
getTotalPlay,
useGame,
useRemainingTime,
} from "../utils/game";
import { getTotalPlay, useGame, useRemainingTime } from "../utils/game";
import { encodeHashed } from "../utils/codec";
import { GAME_STATS_KEY, LAST_HASH_KEY } from "../utils/constants";
import { GameStats, MigrationData } from "../utils/types";
Expand Down Expand Up @@ -64,28 +59,6 @@ export default function Home(props: Props) {

const router = useRouter();

useLayoutEffect(() => {
if (window.location.search.includes("delayMigration")) return;

const isOnLegacyRoute = location.hostname !== "katla.id";
if (isOnLegacyRoute) {
try {
const hash = LocalStorage.getItem(LAST_HASH_KEY) || "";
const stats: GameStats = JSON.parse(
LocalStorage.getItem(GAME_STATS_KEY) || JSON.stringify(initialStats)
);
const migrationLink = generateMigrationLink(hash, stats);
window.location.replace(migrationLink);
} catch (err) {
Sentry.captureException(err, {
extra: {
stats: LocalStorage.getItem(GAME_STATS_KEY),
},
});
}
}
}, []);

useEffect(() => {
const migrationData = router.query.migrate;
if (!migrationData) {
Expand Down

1 comment on commit e244a2d

@vercel
Copy link

@vercel vercel bot commented on e244a2d Oct 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

katla – ./

katla.vercel.app
katla-katla.vercel.app
katla.id
katla-git-main-katla.vercel.app

Please sign in to comment.