Skip to content

Commit 14c22dc

Browse files
authored
Merge pull request #568 from massimoaria/develop
Develop
2 parents 34957a5 + 0459f0d commit 14c22dc

File tree

5 files changed

+51
-19
lines changed

5 files changed

+51
-19
lines changed

inst/biblioshiny/biblioAI.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ geminiSave <- function(values, activeTab){
759759
## Summarize document with Gemini AI ---
760760
summaryAI <- function(values, i, model) {
761761
# Construct the prompt for Gemini AI
762-
prompt <- paste0("Summarize the content of the following publication:",
762+
prompt <- paste0("Summarize the content of the following publication",
763763
" in no more than 250 words. ",
764764
"Title: ", values$M$TI[i],
765765
"Authors: ", values$M$AU[i],

inst/biblioshiny/libraries.R

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
# ### packages for biblishiny()
22
libraries <- function() {
3-
is_windows <- tolower(Sys.info()[["sysname"]]) == "windows"
4-
if (!is_windows & !require(pak, quietly = TRUE)) {
5-
install.packages("pak")
6-
if (!require(pak, quietly = TRUE)) return(FALSE)
7-
}
8-
93
all_ok <- TRUE
104

115
parse_pkg <- function(pkg_str) {
@@ -42,11 +36,7 @@ libraries <- function() {
4236
}
4337

4438
if (need_install) {
45-
if (is_windows) {
46-
install.packages(pkg)
47-
} else {
48-
pak::pkg_install(pkg, ask= FALSE)
49-
}
39+
install.packages(pkg)
5040
}
5141

5242
return(require(pkg, character.only = TRUE, quietly = TRUE))

inst/biblioshiny/server.R

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3225,7 +3225,7 @@ To ensure the functionality of Biblioshiny,
32253225
g <- MGCDocuments()
32263226
TAB <- values$TABGlobDoc
32273227
TAB$DOI<- paste0('<a href=\"https://doi.org/',TAB$DOI,'\" target=\"_blank\">',TAB$DOI,'</a>')
3228-
DTformat(TAB, nrow=10, filename="Most_Global_Cited_Documents", pagelength=TRUE, left=NULL, right=NULL, numeric=4:5, dom=FALSE,
3228+
DTformat(TAB, nrow=10, filename="Most_Global_Cited_Documents", pagelength=TRUE, left=NULL, right=NULL, numeric=5:6, dom=FALSE,
32293229
size='100%', filter="none", columnShort=NULL, columnSmall=NULL, round=2, title="", button=TRUE, escape=FALSE,
32303230
selection=FALSE, summary="documents")
32313231
})
@@ -3301,8 +3301,7 @@ To ensure the functionality of Biblioshiny,
33013301
TAB$DOI <- paste0('<a href=\"https://doi.org/',TAB$DOI,'\" target=\"_blank\">',TAB$DOI,'</a>')
33023302

33033303
names(TAB)[c(1,4:8)] <- c("Paper","Local Citations", "Global Citations","LC/GC Ratio (%)", "Normalized Local Citations","Normalized Global Citations")
3304-
print(names(TAB))
3305-
DTformat(TAB, nrow=10, filename="Most_Local_Cited_Documents", pagelength=TRUE, left=NULL, right=NULL, numeric=6:8, dom=FALSE,
3304+
DTformat(TAB, nrow=10, filename="Most_Local_Cited_Documents", pagelength=TRUE, left=NULL, right=NULL, numeric=7:9, dom=FALSE,
33063305
size='100%', filter="none", columnShort=NULL, columnSmall=NULL, round=2, title="", button=TRUE, escape=FALSE,
33073306
selection=FALSE, summary="documents")
33083307
})

inst/biblioshiny/ui.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1655,14 +1655,14 @@ body <- dashboardBody(
16551655
tabPanel(
16561656
"Global Profile",
16571657
div(
1658-
#style = "height: 550px; overflow-y: scroll; border: 1px solid #ccc; padding: 10px; background-color: #f9f9f9;",
1658+
# style = "height: 700px; overflow-y: scroll; border: 1px solid #ccc; padding: 10px; background-color: #f9f9f9;",
16591659
shinycssloaders::withSpinner(uiOutput("AuthorBioPageUI"))
16601660
)
16611661
),
16621662
tabPanel(
16631663
"Local Profile",
16641664
div(
1665-
#style = "height: 550px; overflow-y: scroll; border: 1px solid #ccc; padding: 10px; background-color: #f9f9f9;",
1665+
# style = "height: 700px; overflow-y: scroll; border: 1px solid #ccc; padding: 10px; background-color: #f9f9f9;",
16661666
shinycssloaders::withSpinner(uiOutput("AuthorLocalProfileUI"))
16671667
)
16681668
),

inst/biblioshiny/utils.R

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,12 +355,55 @@ DTformat <- function(
355355
initComplete <- NULL
356356
# Summary Button
357357
if (summary=="documents" & "Paper" %in% names(df)) {
358+
358359
df <- df %>%
359-
mutate(Summary = paste0('<button id="custom_btn" onclick="Shiny.onInputChange(\'button_id\', \'', Paper, '\')">▶️</button>')) %>%
360+
mutate(Summary = paste0(
361+
'<div style="display: flex; justify-content: center; align-items: center; height: 100%; width: 100%;">',
362+
'<button id="custom_btn" style="',
363+
'width: 24px; height: 24px; ',
364+
'border-radius: 50%; ',
365+
'border: none; ',
366+
'background: linear-gradient(135deg, #4285f4 0%, #1976d2 100%); ',
367+
'color: white; ',
368+
'cursor: pointer; ',
369+
'display: flex; ',
370+
'align-items: center; ',
371+
'justify-content: center; ',
372+
'box-shadow: 0 2px 4px rgba(0,0,0,0.2); ',
373+
'transition: all 0.3s ease; ',
374+
'" ',
375+
'onmouseover="this.style.transform=\'scale(1.1)\'; this.style.boxShadow=\'0 4px 8px rgba(0,0,0,0.3)\';" ',
376+
'onmouseout="this.style.transform=\'scale(1)\'; this.style.boxShadow=\'0 2px 4px rgba(0,0,0,0.2)\';" ',
377+
'onclick="Shiny.onInputChange(\'button_id\', \'', Paper, '\')">',
378+
'<i class="fas fa-search-plus" style="font-size: 14px;"></i>',
379+
'</button>',
380+
'</div>'
381+
)) %>%
360382
select(Summary, everything())
361383
} else if (summary=="historiograph" & "Paper" %in% names(df)) {
362384
df <- df %>%
363-
mutate(Summary = paste0('<button id="custom_btn" onclick="Shiny.onInputChange(\'button_id\', \'', SR, '\')">▶️</button>')) %>%
385+
mutate(Summary = paste0(
386+
'<div style="display: flex; justify-content: center; align-items: center; height: 100%; width: 100%;">',
387+
'<button id="custom_btn" style="',
388+
'width: 32px; height: 32px; ',
389+
'border-radius: 50%; ',
390+
'border: none; ',
391+
'background: linear-gradient(135deg, #4285f4 0%, #1976d2 100%); ',
392+
'color: white; ',
393+
'cursor: pointer; ',
394+
'display: flex; ',
395+
'align-items: center; ',
396+
'justify-content: center; ',
397+
'box-shadow: 0 2px 4px rgba(0,0,0,0.2); ',
398+
'transition: all 0.3s ease; ',
399+
'" ',
400+
'onmouseover="this.style.transform=\'scale(1.1)\'; this.style.boxShadow=\'0 4px 8px rgba(0,0,0,0.3)\';" ',
401+
'onmouseout="this.style.transform=\'scale(1)\'; this.style.boxShadow=\'0 2px 4px rgba(0,0,0,0.2)\';" ',
402+
'onclick="Shiny.onInputChange(\'button_id\', \'', SR, '\')">',
403+
'<i class="fas fa-search-plus" style="font-size: 14px;"></i>',
404+
'</button>',
405+
'</div>'
406+
)) %>%
364407
select(Summary, everything()) %>%
365408
select(-SR)
366409
} else if (summary=="authors" & "Author" %in% names(df)) {

0 commit comments

Comments
 (0)