Skip to content

Commit

Permalink
Refactor font imports and fix eslint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jthoward64 committed Nov 18, 2024
1 parent 4511890 commit a1d62cc
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 25 deletions.
28 changes: 14 additions & 14 deletions packages/mobile/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ import { LoadingWrapper } from "@/context/loading";
import { UrqlContext } from "@/context/urql";
import { navigationIntegration } from "@/navigation/routingInstrumentation";

import BoldoniFlfBoldFont from "./assets/fonts/bodoni-flf-font/Bodoni-FLF-Bold.ttf";
import BoldoniFlfBoldItalicFont from "./assets/fonts/bodoni-flf-font/Bodoni-FLF-Bold-Italic.ttf";
import BoldoniFlfItalicFont from "./assets/fonts/bodoni-flf-font/Bodoni-FLF-Italic.ttf";
import BoldoniFlfRomanFont from "./assets/fonts/bodoni-flf-font/Bodoni-FLF-Roman.ttf";
import OpenSansCondensedBoldFont from "./assets/fonts/opensans-condensed/OpenSans-Condensed-Bold.ttf";
import OpenSansCondensedLightFont from "./assets/fonts/opensans-condensed/OpenSans-Condensed-Light.ttf";
import OpenSansCondensedLightItalicFont from "./assets/fonts/opensans-condensed/OpenSans-Condensed-Light-Italic.ttf";
import { overrideApiBaseUrl } from "./src/common/apiUrl";
// import BoldoniFlfBoldFont from "./assets/fonts/bodoni-flf-font/Bodoni-FLF-Bold.ttf";
// import BoldoniFlfBoldItalicFont from "./assets/fonts/bodoni-flf-font/Bodoni-FLF-Bold-Italic.ttf";
// import BoldoniFlfItalicFont from "./assets/fonts/bodoni-flf-font/Bodoni-FLF-Italic.ttf";
// import BoldoniFlfRomanFont from "./assets/fonts/bodoni-flf-font/Bodoni-FLF-Roman.ttf";
// import OpenSansCondensedBoldFont from "./assets/fonts/opensans-condensed/OpenSans-Condensed-Bold.ttf";
// import OpenSansCondensedLightFont from "./assets/fonts/opensans-condensed/OpenSans-Condensed-Light.ttf";
// import OpenSansCondensedLightItalicFont from "./assets/fonts/opensans-condensed/OpenSans-Condensed-Light-Italic.ttf";
import { FilledNavigationContainer } from "./src/navigation/NavigationContainer";
import { getCustomTheme } from "./src/theme";

Expand Down Expand Up @@ -153,13 +153,13 @@ const App = Sentry.wrap(() => {
useAsyncStorageDevTools();

const [fontsLoaded, error] = useFonts({
// "bodoni-flf-bold": BoldoniFlfBoldFont,
// "bodoni-flf-bold-italic": BoldoniFlfBoldItalicFont,
// "bodoni-flf-italic": BoldoniFlfItalicFont,
// "bodoni-flf-roman": BoldoniFlfRomanFont,
// "opensans-condensed-bold": OpenSansCondensedBoldFont,
// "opensans-condensed-light": OpenSansCondensedLightFont,
// "opensans-condensed-light-italic": OpenSansCondensedLightItalicFont,
"bodoni-flf-bold": BoldoniFlfBoldFont,
"bodoni-flf-bold-italic": BoldoniFlfBoldItalicFont,
"bodoni-flf-italic": BoldoniFlfItalicFont,
"bodoni-flf-roman": BoldoniFlfRomanFont,
"opensans-condensed-bold": OpenSansCondensedBoldFont,
"opensans-condensed-light": OpenSansCondensedLightFont,
"opensans-condensed-light-italic": OpenSansCondensedLightItalicFont,
});

useEffect(() => {
Expand Down
2 changes: 0 additions & 2 deletions packages/mobile/src/common/apiUrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@ import { reloadAsync } from "expo-updates";
import { Logger } from "./logger/Logger";

export let API_BASE_URL =
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
process.env.EXPO_PUBLIC_API_BASE_URL || "https://app.danceblue.org";

export function overrideApiBaseUrl(newUrl: string) {
API_BASE_URL =
newUrl ||
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
process.env.EXPO_PUBLIC_API_BASE_URL ||
"https://app.danceblue.org";
reloadAsync().catch((error: unknown) => {
Expand Down
16 changes: 8 additions & 8 deletions packages/mobile/src/common/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { API_BASE_URL } from "./apiUrl";
import { Logger } from "./logger/Logger";
import { DANCEBLUE_TOKEN_KEY } from "./storage-tokens";

function getLoginUrl(source: AuthSource): string {
function getLoginUrl(source: AuthSource): [string, string] {
let urlComponent = "";
switch (source) {
case AuthSource.LinkBlue: {
Expand All @@ -33,10 +33,12 @@ function getLoginUrl(source: AuthSource): string {
throw new Error(`Unknown auth source: ${source}`);
}
}

const redirectUrl = createURL("/auth/login");
const urlString = `${API_BASE_URL}/api/auth/${urlComponent}?returning=token&redirectTo=${encodeURIComponent(
createURL("/auth/login")
redirectUrl
)}`;
return urlString;
return [urlString, redirectUrl];
}

export const useLogin = (): [boolean, (source: AuthSource) => void] => {
Expand All @@ -49,10 +51,8 @@ export const useLogin = (): [boolean, (source: AuthSource) => void] => {
}
setLoading(true);
try {
const result = await openAuthSessionAsync(
getLoginUrl(source),
createURL("/auth/login")
);
const result = await openAuthSessionAsync(...getLoginUrl(source));
Logger.debug("Auth session result", { context: { result } });
switch (result.type) {
case "success": {
const url = new URL(result.url);
Expand All @@ -77,7 +77,7 @@ export const useLogin = (): [boolean, (source: AuthSource) => void] => {
}
invalidateCache();
} catch (error) {
console.error(error);
Logger.error("Error logging in", { error });
} finally {
setLoading(false);
}
Expand Down
4 changes: 3 additions & 1 deletion packages/server/src/resolvers/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,9 @@ export const graphqlContextFunction: ContextFunction<
? String((req.cookies as Partial<Record<string, string>>).token)
: undefined;
if (!token) {
let authorizationHeader = req.headers.Authorization;
let authorizationHeader =
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
req.headers.Authorization || req.headers.authorization;
if (Array.isArray(authorizationHeader)) {
authorizationHeader = authorizationHeader[0];
}
Expand Down

0 comments on commit a1d62cc

Please sign in to comment.