Skip to content

Commit

Permalink
feat: update to use new api
Browse files Browse the repository at this point in the history
  • Loading branch information
wfnuser committed Jul 18, 2024
1 parent f0fa1e1 commit 2f7cffc
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 172 deletions.
16 changes: 10 additions & 6 deletions src/components/ui/chart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,10 @@ const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {
return null
}

return (
<style
dangerouslySetInnerHTML={{
__html: Object.entries(THEMES).map(
([theme, prefix]) => `
// TODO: fix it...
const htmlStr = Object.entries(THEMES)
.map(
([theme, prefix]) => `
${prefix} [data-chart=${id}] {
${colorConfig
.map(([key, itemConfig]) => {
Expand All @@ -79,7 +78,12 @@ ${colorConfig
.join('\n')}
}
`,
),
)
.toString()
return (
<style
dangerouslySetInnerHTML={{
__html: 'htmlStr',
}}
/>
)
Expand Down
13 changes: 6 additions & 7 deletions src/pages/task/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ function TaskItem({ item }: { item: Issue }) {
<CardTitle>{item.title}</CardTitle>
</CardHeader>
<CardContent className="flex-1">
<div className="flex flex-col justify-between h-full overflow-hidden rounded">
<div className="flex h-full flex-col justify-between overflow-hidden rounded">
<div>
<div className="flex items-center mb-4">
<img className="w-12 h-12 mr-4 rounded-full" src={item.user.avatar_url} alt="User Avatar" />
<div className="mb-4 flex items-center">
<img className="mr-4 h-12 w-12 rounded-full" src={item.user.avatar_url} alt="User Avatar" />
<div className="text-sm">
<p className="leading-none text-gray-900">{item.user.login}</p>
<p className="text-gray-600">{item.user.html_url}</p>
Expand All @@ -51,17 +51,16 @@ function TaskItem({ item }: { item: Issue }) {
<div className="flex justify-between">
<div>
<p className="text-gray-600">State: {item.state}</p>
<p className="text-gray-600">Comments: {item.comments}</p>
</div>
<div>
<p className="text-gray-600">Created At: {new Date(item.created_at).toLocaleDateString()}</p>
<p className="text-gray-600">Updated At: {new Date(item.updated_at).toLocaleDateString()}</p>
</div>
</div>
</div>
<div className="flex justify-end gap-2 mt-8">
<div className="mt-8 flex justify-end gap-2">
<Button asChild variant="link">
<a href={item.html_url} target="_blank" rel="noreferrer">
<a href={item.url} target="_blank" rel="noreferrer">
View Issue
</a>
</Button>
Expand Down Expand Up @@ -121,7 +120,7 @@ export default function Task() {
{loading ? (
<SkeletonTasks />
) : tasks.length ? (
tasks.map((item) => <TaskItem key={item.id} item={item} />)
tasks.map((item) => <TaskItem key={item.title} item={item} />)
) : (
<EmptyTasks />
)}
Expand Down
168 changes: 10 additions & 158 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,148 +36,16 @@ export interface TaskItem extends BaseItem {

export interface Repository {
id: number
node_id: string
name: string
full_name: string
private: boolean
owner: {
login: string
id: number
node_id: string
avatar_url: string
gravatar_id: string
url: string
html_url: string
followers_url: string
following_url: string
gists_url: string
starred_url: string
subscriptions_url: string
organizations_url: string
repos_url: string
events_url: string
received_events_url: string
type: string
site_admin: boolean
}
html_url: string
description: string | null
fork: boolean
url: string
forks_url: string
keys_url: string
collaborators_url: string
teams_url: string
hooks_url: string
issue_events_url: string
events_url: string
assignees_url: string
branches_url: string
tags_url: string
blobs_url: string
git_tags_url: string
git_refs_url: string
trees_url: string
statuses_url: string
languages_url: string
stargazers_url: string
contributors_url: string
subscribers_url: string
subscription_url: string
commits_url: string
git_commits_url: string
comments_url: string
issue_comment_url: string
contents_url: string
compare_url: string
merges_url: string
archive_url: string
downloads_url: string
issues_url: string
pulls_url: string
milestones_url: string
notifications_url: string
labels_url: string
releases_url: string
deployments_url: string
created_at: string
updated_at: string
pushed_at: string
git_url: string
ssh_url: string
clone_url: string
svn_url: string
homepage: string | null
size: number
stargazers_count: number
watchers_count: number
language: string
has_issues: boolean
has_projects: boolean
has_downloads: boolean
has_wiki: boolean
has_pages: boolean
has_discussions: boolean
forks_count: number
mirror_url: string | null
archived: boolean
disabled: boolean
open_issues_count: number
license: string | null
allow_forking: boolean
is_template: boolean
web_commit_signoff_required: boolean
topics: string[]
visibility: string
forks: number
open_issues: number
watchers: number
default_branch: string
permissions: {
admin: boolean
maintain: boolean
push: boolean
triage: boolean
pull: boolean
}
security_and_analysis: {
secret_scanning: {
status: string
}
secret_scanning_push_protection: {
status: string
}
dependabot_security_updates: {
status: string
}
secret_scanning_non_provider_patterns: {
status: string
}
secret_scanning_validity_checks: {
status: string
}
}
}

interface User {
login: string
id: number
node_id: string
avatar_url: string
gravatar_id: string
url: string
html_url: string
followers_url: string
following_url: string
gists_url: string
starred_url: string
subscriptions_url: string
organizations_url: string
repos_url: string
events_url: string
received_events_url: string
type: string
site_admin: boolean
language: string | null
owner: User
}

interface PullRequest {
Expand All @@ -201,35 +69,19 @@ interface Reactions {
eyes: number
}

export interface User {
login: string
html_url: string
avatar_url: string
}

export interface Issue {
url: string
repository_url: string
labels_url: string
comments_url: string
events_url: string
html_url: string
id: number
node_id: string
number: number
title: string
user: User
labels: any[]
state: string
locked: boolean
assignee: any
assignees: any[]
milestone: any
comments: number
created_at: string
updated_at: string
closed_at: string
author_association: string
active_lock_reason: any
draft: boolean
pull_request: PullRequest
body: any
reactions: Reactions
timeline_url: string
performed_via_github_app: any
state_reason: any
body: string
assignees: User[]
}
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default defineConfig({
port: 3000,
proxy: {
'/api': {
target: 'http://183.131.108.116:3000',
target: 'http://124.221.119.233:5050',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''),
},
Expand Down

0 comments on commit 2f7cffc

Please sign in to comment.