Skip to content

Instantly share code, notes, and snippets.

View adhithiravi's full-sized avatar
🎯
Focusing

Adhithi Ravichandran adhithiravi

🎯
Focusing
View GitHub Profile
@adhithiravi
adhithiravi / page.tsx
Created June 26, 2024 15:17
Speaker information
export default async function Speaker({
params: { slug },
}: {
params: { slug: string };
}) {
const speakerInfo = await getSpeakerInfo(slug);
const { name, bio, id, sessions }: SpeakerWithSessions = speakerInfo;
return (
<section key={id} className={styles.infoContainer}>
@adhithiravi
adhithiravi / loading.tsx
Created June 26, 2024 15:15
Loading grid
import styles from "./conference.module.css";
/** Loading skeleton for conference sessions and speakers page */
export default function Loading() {
// You can add any UI inside Loading, including a Skeleton.
return (
<>
{Array(10)
.fill(1)
.map((index) => (
@adhithiravi
adhithiravi / conferece.module.css
Created June 26, 2024 15:14
Skeleton loading grid style
.skeletonContainer {
display: block;
box-sizing: inherit;
margin-top: 1rem;
background-color: lightgray;
padding: 10px;
height: 200px;
}
@adhithiravi
adhithiravi / conferece.module.css
Created June 26, 2024 15:14
Skeleton loading grid style
.skeletonContainer {
display: block;
box-sizing: inherit;
margin-top: 1rem;
background-color: lightgray;
padding: 10px;
height: 200px;
}
@adhithiravi
adhithiravi / page.tsx
Created June 26, 2024 15:13
Sessions page with data fetching
import styles from "../conference.module.css";
import { SpeakerSummary } from "../speakers/page";
import {
fetchSpeakers,
getSpeakerDetails,
} from "../speakers/services/speakers";
import { fetchSessions } from "./services/sessions";
export default async function Sessions() {
const sessionsData = await fetchSessions();
@adhithiravi
adhithiravi / page.tsx
Created June 26, 2024 15:09
Update Speakers page to fetch speraker info and display it
import styles from "../conference.module.css";
import { fetchSpeakers } from "./services/speakers";
export type Speaker = {
id: string;
name: string;
bio: string;
featured?: boolean;
};
@adhithiravi
adhithiravi / conferece.module.css
Created June 26, 2024 15:07
Additional styles for conference page
.parentContainer {
margin: 50px;
}
.infoContainer {
display: block;
box-sizing: inherit;
margin-top: 1rem;
background-color: #262630;
padding: 10px;
import * as Keychain from 'react-native-keychain';
import DeviceInfo from 'react-native-device-info'
async () => {
const username = 'adhithi';
const password = 'poniesRgr8';
const server = DeviceInfo.getBundleId()
// Store the credentials
await Keychain.setInternetCredentials(server, email, password).then(() => {
Keychain.getInternetCredentials(server).then(credentials => {
if (credentials) {
console.log('Credentials successfully loaded for user ' + credentials.username)
}
else {
console.log('Could not retrieve credentials for server')
}
}).catch(error => {
console.log('Could not get credentials from keychain')
})
// using react-native-device-info to get server information
const server = DeviceInfo.getBundleId()
Keychain.setInternetCredentials(server, email, password).then(() => {
console.log('Saved internet credentials')
}).catch(error => {
console.log('Could not save credentials')
})