-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(odin): use monorepo contents/odin (#713)
# Description Please describe your changes. Be descriptive enough to reduce churn for review process. ### Checklist - [ ] discord username: `username#0001` - [ ] Closes #<issue-number> - [ ] PR must be created for an issue from issues under "In progress" column from [our project board](https://github.com/orgs/kamp-us/projects/2/views/1). - [ ] A descriptive and understandable title: The PR title should clearly describe the nature and purpose of the changes. The PR title should be the first thing displayed when the PR is opened. And it should follow the semantic commit rules, and should include the app/package/service name in the title. For example, a title like "docs(@kampus-apps/pano): Add README.md" can be used. - [ ] Related file selection: Only relevant files should be touched and no other files should be affected. - [ ] I ran `npx turbo run` at the root of the repository, and build was successful. - [ ] I installed the npm packages using `npm install --save-exact <package>` so my package is pinned to a specific npm version. Leave empty if no package was installed. Leave empty if no package was installed with this PR. ### How were these changes tested? Please describe the tests you did to test the changes you made. Please also specify your test configuration. --------- Co-authored-by: Can Sirin <8138047+cansirin@users.noreply.github.com>
- Loading branch information
Showing
61 changed files
with
232 additions
and
5,042 deletions.
There are no files selected for viewing
File renamed without changes.
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
40 changes: 40 additions & 0 deletions
40
apps/kampus/app/odin/mufredat/[[...lesson]]/OdinLessonActions.tsx
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { graphql, useFragment } from "react-relay"; | ||
|
||
import { getOdinGithubEditUrl, getOdinGithubIssueUrl } from "~/features/kampus-url/kampus-github"; | ||
import { type OdinLessonActions_path$key } from "./__generated__/OdinLessonActions_path.graphql"; | ||
|
||
interface Props { | ||
lesson: OdinLessonActions_path$key | null; | ||
} | ||
|
||
const useOdinLessonActionsFragment = (key: OdinLessonActions_path$key | null) => | ||
useFragment( | ||
graphql` | ||
fragment OdinLessonActions_path on OdinLesson { | ||
title | ||
path | ||
} | ||
`, | ||
key | ||
); | ||
|
||
export const OdinLessonActions = (props: Props) => { | ||
const lesson = useOdinLessonActionsFragment(props.lesson); | ||
if (!lesson?.path) return null; | ||
// https://github.com/kamp-us/monorepo/edit/dev/contents/odin/foundations/installations/installation_overview.md | ||
const contributionUrl = getOdinGithubEditUrl(lesson.path); | ||
const issueUrl = getOdinGithubIssueUrl({ title: lesson.title, path: lesson.path }); | ||
|
||
return ( | ||
<div className="border-t-border border-t-2 pt-4"> | ||
<ul className="flex gap-10"> | ||
<li> | ||
<a href={contributionUrl}>Katkıda bulun</a> | ||
</li> | ||
<li> | ||
<a href={issueUrl}>Bir sorun bildir</a> | ||
</li> | ||
</ul> | ||
</div> | ||
); | ||
}; |
50 changes: 50 additions & 0 deletions
50
apps/kampus/app/odin/mufredat/[[...lesson]]/__generated__/OdinLessonActions_path.graphql.ts
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
22 changes: 17 additions & 5 deletions
22
apps/kampus/app/odin/mufredat/[[...lesson]]/__generated__/OdinLessonQuery.graphql.ts
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,5 +1,5 @@ | ||
import { type ReactNode } from "react"; | ||
|
||
export default function OdinLessonLayout({ children }: { children: ReactNode }) { | ||
return <main className="container flex min-h-screen flex-col">{children}</main>; | ||
return <main className="container flex mx-auto flex-col">{children}</main>; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
const branchName = "dev"; | ||
const baseUrl = "https://github.com/kamp-us/monorepo/"; | ||
|
||
export const getOdinGithubUrl = ({ edit }: { edit: boolean }) => { | ||
let url = baseUrl; | ||
if (edit) { | ||
url = url + "edit"; | ||
} else { | ||
url = url + "blob"; | ||
} | ||
|
||
return `${url}/${branchName}/contents/odin`; | ||
}; | ||
|
||
export const getOdinGithubEditUrl = (path = "") => { | ||
path = path.replaceAll("-", "_"); | ||
if (path.endsWith(".mdx")) { | ||
path = path.replace(".mdx", ".md"); | ||
} | ||
|
||
return `${getOdinGithubUrl({ edit: true })}/${path}`; | ||
}; | ||
|
||
interface Lesson { | ||
title: string; | ||
path: string; | ||
} | ||
|
||
export const getOdinGithubIssueUrl = (lesson: Lesson) => { | ||
const params = { | ||
template: "suggestion.yaml", | ||
title: `${lesson.title}: <Önerinizin kısa bir açıklaması>`, | ||
"lesson-link": lesson.path, | ||
}; | ||
|
||
return `${baseUrl}/issues/new?${new URLSearchParams(params).toString()}`; | ||
}; |
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
Oops, something went wrong.